PHP MySQL Insert Syntax
| From: | kvigor | Date: | Tue, 01 Apr 2008 17:30:33 +0000 |
| Subject: | PHP MySQL Insert Syntax | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-272421@lists.php.net to get a copy of this message | ||
/*I'm trying to insert values from an array into MySQL DB but the insert
begins at the last record in the table and not at first record in the table.
I have added the cellSuffixes column after I already populated 30 records in
other columns*/
Code:
foreach($list as $key=>$value)
{
$query = "INSERT INTO carriers (cellSuffixes) VALUES('$value')";
mysql_query($query,$connex) or die("Query failed: ".
mysql_error($connex));
}
echo "done";
mysql_close($connex);
//I don't know what the sytax s/b to get the data to be inserted in the
first row of the column.