Inserting integer and datetime from PHP to MySQL 5.0 db error -


I have tried to figure out what is wrong.

The table is conditions_loop. A column is condition_id, and the second is a date time type.

This code is

  $ dt = date ("Y-M-DH: I: S"); Mysql_query ("Insert under conditions (status_it, date) value (latest code, $ dt)" or die (mysql_error ());   

$ Latest code is 1 digit integer.

The error says there is an error in your SQL syntax;

I tried to do everything, but it's something that I'm not doing, manual that matches mysql server version for my simulator, near '13: 12 : 14) Use. To know Thanks for reading.

You should quote the date value:

  Mysql_query (" Condition_loop` (`condition_id`,` date`) values ​​('$ latest_condition', '$ dt') ") or die (mysql_error ());   

And when you are on it, quote table / field names by using backtakes (`)

Comments