I use jQuery datepicker with the following code
$(".item").datepicker({
showWeek: true,
firstDay: 1,
minDate: -30,
dateFormat: 'mm-dd-yy'
});
The value of that datepicker will be sent via ajax to php function which insert a data in mysql table.
The date column type from mysql database is Datetime.
Every time when read value from datepicker input value, the date column in database is empty shows 00-00-0000 00:00:00.
I am newbie in php and maybe I made somewhere a mistake.
the php piece of code
mysqli_query($connect, "Insert into tab(date) values ('".$myData."')");
how to format javascript date in that right for mysql ?
Can you first verify that the datepicker is posting a correct value to the server?
Try alert the value somewhere.
If you have the correct input from the javascript, the php part of the script can be done like this:
Echo out to confirm you have it right, and finally insert that $date into the table.