It sounds stupid, but for life I canβt understand. I have tried everything.
The problem is that I cannot figure out how to get the date string in my MySQL table ... I first converted to Unix to account for changes in the input format.
$_POST['date'] is in this format: 19-1-2013 4:43:32
$datestr= strtotime($_POST['date']); echo $datestr; $sql = "INSERT INTO `calendar` (`date`, `title`, `event`) VALUES ('FROM_UNIXTIME(".$datestr.")', '".mysql_real_escape_string($_POST['title'])."', '".mysql_real_escape_string($_POST['desc'])."')"; $query = mysql_query($sql);
This is the last thing I tried, and still getting all the zeros in the DATETIME field.
Please, what am I doing wrong?
source share