bcraig Posted October 6, 2008 Share Posted October 6, 2008 Im using PHP and i want to select records from my database where the month within a date datatype field is equal to a set variable. I dont know if this is possible? I have this now $dateFormat = date('m'); $monthNo = 10; $sql_month = sprintf("SELECT * FROM gigs WHERE '%s' = '%s'", $dateFormat, $monthNo); But that shows all records dated with all different months in the database Quote Link to comment Share on other sites More sharing options...
aebstract Posted October 6, 2008 Share Posted October 6, 2008 How is your table set up? Need a little bit more information to help you out here. Quote Link to comment Share on other sites More sharing options...
Barand Posted October 7, 2008 Share Posted October 7, 2008 SELECT * FROM gigs WHERE MONTH(datecolname) = $monthNo 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.