stevoh Posted December 21, 2005 Share Posted December 21, 2005 Hello, I keep recieving the following error: "The conversion of char data type to smalldatetime data type resulted in an out-of-range smalldatetime value" everytime I try and enter a date in the format of 12/05/2005 into my DB. my code looks like //Grab date for entry into database $day = date("j"); $month = date("n"); $year = date("Y"); $date = date('d/m/Y', mktime(0, 0, 0, $month, $day, $year)); // Retrieve answer to question 1 and display $booking = $_POST['holdingName1']; echo ("<b>$booking</b>"); // query to add sigle answered form data into database $insert_query = "INSERT INTO answers (id, qid, surveyNum, answer, date) VALUES ('$var', '1', '1', '$booking', '$date')"; $result = odbc_exec($connection, $insert_query); $date returns the format stated above but it wont allow me to enter itno the DB...WHY!!!!! Please...Please...someone help Best Regards Stevoh Quote Link to comment https://forums.phpfreaks.com/topic/3084-sql-error-when-trying-to-insert-date-into-database/ Share on other sites More sharing options...
Munchen Posted January 5, 2006 Share Posted January 5, 2006 Hi there! Please try to post the database layout, that just might provide the answer ... Quote Link to comment https://forums.phpfreaks.com/topic/3084-sql-error-when-trying-to-insert-date-into-database/#findComment-10625 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.