I've got the following nested array which I'm trying to write into a MySQL database table:
$allevents Array (
[0] => Array (
[title] => Food fight
[date] => 5 Dec
)
[1] => Array (
[title] => Water fight
[date] => 7 Dec
)
)
I'm using the php code
$db_table = "events";
foreach ($allevents as $key => $value) {
mysql_query('INSERT INTO $db_table
(title, date) VALUES('$value["title"]', '$value["date"]' ) ')
or die(mysql_error());
}
But keep getting the error: Parse error: syntax error, unexpected T_VARIABLE in /home/.flute/alexcg/chinanetworker/bob/feedfiller/includes/save-mysql.php on line 41
(line 41 is the foreach line quoted above)
Can anyone tell me what I'm doing wrong?