I have a table named ORDER with the title order_date where I need to put the date.
function NewOrderID()
{
$date = date('Y-m-d H:i:s');
$t = "INSERT INTO order (order_date)
VALUES (' ".$date." ')";
$query = sprintf($t);
$result = mysql_query($query);
if (!$result)
die(mysql_error());
return mysql_insert_id();
}
and I got the following error:
You have an error in your SQL syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use near 'order ('order_date')
VALUES (' 2014-04-29 15:02:40 ')' at line 1
Any ideas where I messed up with the query?