I am using a datetimepicker from jQuery, and when I select a date from the datetimepicker it puts it in this format:
11/10/2011 14:02
Now when I try to insert it into my sql table like this
INSERT INTO MYTABLE (date, name) values ('$_POST[datepicker]','$_POST[name]')
it says the date is not in the correct format.
Can someone please help me determine how to format such date so that it is accepted by the datetime() field ?
Thank you
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 '14:33:00,1,2,'Y')' at line 2
$datetosave = date("Y-m-d H:i:s", strtotime($_POST[date]));
$insert_q = "INSERT INTO reservations (res_date, res_numofseats, user_id, rsvp)
VALUES ($datetosave,$_POST[cars],2,'Y')";