I am having trouble storing array contents in mysql I am using the code below
foreach($found_entry as $key => $sd) {
echo \"$key => $sd
Your query syntax is wrong. Use SET
instead of VALUES
. Also, you probably don't need the foreach loop at all, as you are referencing both $sd[0]
and $sd[11]
. Try something like this:
$query = sprintf("INSERT INTO
myTable
SET
ID = '%s',
folder = NULL,
Tsi = '%s',
PT = 'NA'",
mysql_real_escape_string($found_entry[0]),
mysql_real_escape_string($found_entry[11])
);
mysql_query($query) or die(mysql_error());