evil_stevo Posted December 13, 2010 Share Posted December 13, 2010 $username = $_POST['username']; $password = $_POST['password']; $month = $_POST['month']; $day = $_POST['day']; $year = $_POST['year']; $query = mysql_query("INSERT INTO users VALUES ('','$username','$password','$month','$day','$year') mysql_query($query); The code above is a sample of what I have but what I want is to store an entire birthdate in ONE SQL cell. More like this... $username = $_POST['username']; $password = $_POST['password']; $month = $_POST['month']; $day = $_POST['day']; $year = $_POST['year']; $query = mysql_query("INSERT INTO users VALUES ('','$username','$password','$birthdate') mysql_query($query); How is this possible? Can I do this and actually use it efficiently in the future? Link to comment https://forums.phpfreaks.com/topic/221565-sign-up-page-birth-date/ Share on other sites More sharing options...
nafetski Posted December 13, 2010 Share Posted December 13, 2010 The short answer $birthday = $month . $day . $year The longer answer... Some may disagree, but storing a date as a unix timestamp is almost always more efficient (in both storage, query speed, and ease of manipulation). You can use php's strtotime function to get a unix timestamp from date formats. Hopefully this helps! Link to comment https://forums.phpfreaks.com/topic/221565-sign-up-page-birth-date/#findComment-1146931 Share on other sites More sharing options...
litebearer Posted December 13, 2010 Share Posted December 13, 2010 a brief discussion of timestamp vs datetime http://stackoverflow.com/questions/409286/datetime-vs-timestamp Link to comment https://forums.phpfreaks.com/topic/221565-sign-up-page-birth-date/#findComment-1146937 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.