I'm trying to insert a datetime value into my SQL database using PHP.
This is my code:
$time= date('Y-m-d H:i:s.u');
$ordersquery= "INSERT INTO Orders (customerID, orderDate) VALUES ('{$phonenumber}', '{$time}')";
echo $ordersquery."\n";
Whenever I try to execute the code, there is a failure to enter the information into the database that reads:
INSERT INTO Orders (customerID, orderDate) VALUES ('(444) 849-7592', '2015-05-10 12:03:28.000000')
boolean false
Conversion failed when converting date and/or time from character string.
null
I've also tried using CURRENT_TIMESTAMP and using ISO-8601 format.
orderDate?