Rommeo Posted June 10, 2010 Share Posted June 10, 2010 I have the birthdate values sent from a form that are : day(ex : 31) / month(ex : 12) / year(ex : 1900) and I want to insert it to "bdate(DATE)" column in mysql. Which function should I use to correct the values for to insert mysql ? insert into people ( .... surname, bdate, gender..... ) values ( .......'$surname', $bdate, '$gender') Link to comment https://forums.phpfreaks.com/topic/204401-a-short-question-about-date-inserting/ Share on other sites More sharing options...
premiso Posted June 10, 2010 Share Posted June 10, 2010 If the column they are being entered into is a DATE column you just have to combine them to be in the form of: YYYY-MM-DD And they will go in just fine. Link to comment https://forums.phpfreaks.com/topic/204401-a-short-question-about-date-inserting/#findComment-1070386 Share on other sites More sharing options...
syed Posted June 10, 2010 Share Posted June 10, 2010 just to add to premiso $dob = $year . "-" . "$month . "-" . $day; Link to comment https://forums.phpfreaks.com/topic/204401-a-short-question-about-date-inserting/#findComment-1070392 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.