
Originally Posted by
mikeypp
Help I am using these parameters and cannot solve the issue of wrong date in the database:
$DateAA=date('Y/m/d', $_POST['DateAA']);
$DateBB=date('Y/m/d', $_POST['DateBB']);
$query = sprintf ( "insert into places ( DateAA, DateBB )values ( '%s', '%s' ) )", mysql_real_escape_string($DateAA),
mysql_real_escape_string($DateBB) );
I have to use the sprintf since this string is actually quit larger with many other string variables. etc... but all I get is the incorrect date of 1969-12-31 and 1969-12-31 respectfully in MYSQL. The date was gotten from a form variable where DATEAA and DATEBB are assigned a date chosen by the user. In this case it was 1/10/2009 and 7/12/2012. Of course the date really doesnt matter I am just showing the format.
I have tried many things form this forum and every other but can't get passed the error from string to a date in the database.
I tried this solution posted in this forum "$date = mysql_real_escape_string($_POST['date']);
$date = implode('-', array_reverse(explode('-', $date))); " and many many others but all that occurs with this one is the the date in the database goes to 0000-00-00.
Bookmarks