Hi i know this is a very basic problem but i cant find a way to solve it. Have been through this forum too and dont find anything.
So I've got a form in my html page, and one of the fields (hidden) contains the following:
<input name="datetime" type="hidden" id="datetime" value="<?php echo(date("Y-m-j H:i:s"))?>">
I process the form through php and i try to send a query to mysql server in order to store that date. In my database, i have a field called datetime, type datetime.
$insertSQL = sprintf("INSERT INTO comment (name, text, datetime) VALUES (%s, %s, %s)",
GetSQLValueString($HTTP_POST_VARS['who'], "text"),
GetSQLValueString($HTTP_POST_VARS['what'], "text"),
GetSQLValueString($HTTP_POST_VARS['datetime'], "datetime"));
This is what i get from the server:
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 '04:39:20)' at line 1
I have tried lots of things but cant find why the format is wrong.
Does anyone know what to do please?
So I've got a form in my html page, and one of the fields (hidden) contains the following:
<input name="datetime" type="hidden" id="datetime" value="<?php echo(date("Y-m-j H:i:s"))?>">
I process the form through php and i try to send a query to mysql server in order to store that date. In my database, i have a field called datetime, type datetime.
$insertSQL = sprintf("INSERT INTO comment (name, text, datetime) VALUES (%s, %s, %s)",
GetSQLValueString($HTTP_POST_VARS['who'], "text"),
GetSQLValueString($HTTP_POST_VARS['what'], "text"),
GetSQLValueString($HTTP_POST_VARS['datetime'], "datetime"));
This is what i get from the server:
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 '04:39:20)' at line 1
I have tried lots of things but cant find why the format is wrong.
Does anyone know what to do please?