adzie Posted April 20, 2009 Share Posted April 20, 2009 Hello folks, I want to be able to select information from my table by date so i want to select where the date field is todays date Quote Link to comment Share on other sites More sharing options...
envexlabs Posted April 20, 2009 Share Posted April 20, 2009 $today = date('YOUR DATE FORMAT'); $select = mysql_query("SELECT * FROM `table` WHERE `date` = '$date'"); Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted April 20, 2009 Share Posted April 20, 2009 It all depends on how you have your date field set up in the database, but if you have it set up using one of mysql dates, you could use one of these: $select = mysql_query("SELECT * FROM `table` WHERE `date` = CURDATE()"); $select = mysql_query("SELECT * FROM `table` WHERE `date` = NOW()"); $select = mysql_query("SELECT * FROM `table` WHERE `date` = DATE_FORMAT(date,format)"); Quote Link to comment Share on other sites More sharing options...
adzie Posted April 20, 2009 Author Share Posted April 20, 2009 thanks chaps, yes its a datetime field 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.