runnerjp Posted March 15, 2010 Share Posted March 15, 2010 $getthreads ="Select * from races WHERE date >= 'date("d/m/Y")' ORDER BY date ASC"; how do i use the function is this does not work Quote Link to comment https://forums.phpfreaks.com/topic/195295-using-the-date-function-in-a-mysql-query/ Share on other sites More sharing options...
PFMaBiSmAd Posted March 15, 2010 Share Posted March 15, 2010 What type of values are in your date column? For what you posted, the mysql date() function expects a value or column that is either a DATE or DATETIME. If you are trying to use the php date() function, you would need to break out of the SQL query string so that php would parse the function call instead of mysql parsing it. You can also only compare dates when the parts of the date are ordered left to right, most significant digit (year) to least significant digit (day), and the length of each corresponding field in the two values being compared is the same. Quote Link to comment https://forums.phpfreaks.com/topic/195295-using-the-date-function-in-a-mysql-query/#findComment-1026275 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.