MDanz Posted August 3, 2010 Share Posted August 3, 2010 how do i store date of birth into mysql. I have mysql field type as DATE. I tried this but not working.. $date = $yearOfBirth.'-'.$monthOfBirth.'-'.$dateOfBirth; $prof = "INSERT INTO Profile"; $prof .= "(`username`,`location`,`gender`,`dateofbirth`,`information`) VALUES ('$username','$location','$gender',$date,'$about')"; $profresults = mysql_query($prof)or die (mysql_error()); the date shows as 0000-00-00 Link to comment https://forums.phpfreaks.com/topic/209626-help-storing-dat-of-birth/ Share on other sites More sharing options...
PFMaBiSmAd Posted August 3, 2010 Share Posted August 3, 2010 Literal date values must be enclosed in single-quotes inside the query, otherwise they look like a mathematical expression (2010 - 08 - 02 equals 2000). Link to comment https://forums.phpfreaks.com/topic/209626-help-storing-dat-of-birth/#findComment-1094414 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.