MDanz Posted September 16, 2009 Share Posted September 16, 2009 when i check the database in the DATETIME field it has 0000-00-00 00:00:00 heres how i insert into db, the field posted is DATETIME type. everytime i check a new record it has the value 0000-00-00 00:00:00. when it should say the current date and time. $query = "INSERT INTO Stacks"; $query .= "(`username`,`hyperlink`,`name`,`summary`,`info`,`keywords`,`posted`) VALUES ('$username','$hyperlink','$name','$summary','$info','$keywords','NOW()')"; Link to comment https://forums.phpfreaks.com/topic/174453-solved-insert-datetime-help/ Share on other sites More sharing options...
PFMaBiSmAd Posted September 16, 2009 Share Posted September 16, 2009 Strings have single-quotes around them. NOW() is not a string, it is a mysql function. Remove the single-quotes from around it. Link to comment https://forums.phpfreaks.com/topic/174453-solved-insert-datetime-help/#findComment-919464 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.