MySQL Date insert

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,
   I have the following PHP code:

$date = date("Y-m-d H:i:s");
$result = mysql_query("INSERT INTO Boats (Make, Model, Serial, Stock, Extension, Cust_Name, Store, Date) VALUES
('$make', '$model', '$serial', '$stock', '$extension', '$name', '$store', '$date'")
or die("Invalid query: " . mysql_error() . "</body></html>");


The problem is with the Date column. It is of type DATETIME. I get an error on the second line of the insert statement. I assume I'm not putting formatting the date-time variable correctly but I've tried everything I can think of, so any help is very much appreciated. Thanks.

Andrew.

[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux