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 Quote 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). Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.