marukochan Posted February 12, 2007 Share Posted February 12, 2007 Can someone tell me why my query for date part gives me an error The code goes something like this ... ... $month = $_POST['month']; $query = mysql_query("SELECT * FROM project WHERE DATEPART(month, date_award)='$month'") or die(mysql_error()); ... .... The error is Unknown column 'month' in 'where clause' Do I need to include anything in order to use DATEPART. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/38136-solved-datepart-error/ Share on other sites More sharing options...
thepip3r Posted February 12, 2007 Share Posted February 12, 2007 There is no DATEPART in MySQL... http://forums.mysql.com/read.php?10,95045,95045#msg-95045 here are the valid date/time functions for MySQL: http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html Quote Link to comment https://forums.phpfreaks.com/topic/38136-solved-datepart-error/#findComment-182572 Share on other sites More sharing options...
marukochan Posted February 12, 2007 Author Share Posted February 12, 2007 Really?! I must be reading the wrong tutorial. Thanks thepip3r. Quote Link to comment https://forums.phpfreaks.com/topic/38136-solved-datepart-error/#findComment-182677 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.