robert_gsfame Posted September 4, 2009 Share Posted September 4, 2009 Small things, but really difficult to find the error........ i have my column inside table --> date(datetime) the problem is that once i try to insert the date using: $date = date("YYYY-mm-dd H:i:s"); $query = "INSERT INTO xxxxxx(date)VALUES('$date'); $results = mysql_query('$query'); why does the date column still (0000-00-00 00:00:00) , although the other columns have been inserted which means i don't get any problems with the connection Quote Link to comment Share on other sites More sharing options...
rhodesa Posted September 4, 2009 Share Posted September 4, 2009 don't use Date as a column name...it's a reserved word in MySQL Quote Link to comment Share on other sites More sharing options...
robert_gsfame Posted September 4, 2009 Author Share Posted September 4, 2009 okay i've changed it but still give me the same result.. Do i have to change the format of the date?? it's easier to have it in VARCHAR format, but yet it will create new problem as i want to sort the records based on datetime Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted September 4, 2009 Share Posted September 4, 2009 date("YYYY-mm-dd H:i:s") means - 2009200920092009-0909-0404 09:57:00 (depending on where you are at.) you want date("Y-m-d H:i:s") Quote Link to comment Share on other sites More sharing options...
robert_gsfame Posted September 4, 2009 Author Share Posted September 4, 2009 Thx for your help...Finally, i've found out what makes this error! Wrong parameters name Quote Link to comment 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.