Inserting a Date into Database

RAPEDEABY

New Member
I'm trying to retrieve user data form a form and save the data into a database. I'm trying to retrieve the following data: 1) First Name 2) Last Name 3) Major 4) YearSQL syntax: \[code\]CREATE TABLE `tblStudents` ( `id` int(11) NOT NULL AUTO_INCREMENT, `first_name` varchar(30) NOT NULL, `last_name` varchar(50) NOT NULL, `major` varchar(40) NOT NULL, `year` date NOT NULL, PRIMARY KEY (`id`))\[/code\]I am able to save all but the Year in the database. Right now, the year that is selected is not saved in the database. It looks like this: 0000-00-00.In the form, a user selects the year from a dropdown menu.\[code\] <select name="year" id="year"> <option value="http://stackoverflow.com/questions/3612237/2010">2010-06-12</option> <option value="http://stackoverflow.com/questions/3612237/2011">2011-06-12</option> <option value="http://stackoverflow.com/questions/3612237/2012">2012-06-12</option> <option value="http://stackoverflow.com/questions/3612237/2013">2013-06-12</option> <option value="http://stackoverflow.com/questions/3612237/2014">2014-06-12</option> </select>\[/code\]The data type for the 'Year' column is date. Am I required to specify something else in order for the date to be saved in the database.
 
Back
Top