peddel Posted August 20, 2008 Share Posted August 20, 2008 I got a MySQL table with some collums, the important collums are the following : DAY - MONTH - YEAR - HOUR - MINUTE The filling of this collums happens by using a date object and splitting it into the right sections. I got a form with 6 drop down boxes for a person to select a start and a ending date. Start boxes : DAY - MONTH - YEAR End boxes: DAY - MONTH - YEAR Now i want to find all the records in my table between these 2 dates. Someone suggested me to use the following code SELECT * FROM `dt_tb` WHERE dt BETWEEN '2005-01-01' AND '2005-12-31' Problem here is that i splitted the information, so its kinda hard to use that code. Can anyone help out? Quote Link to comment Share on other sites More sharing options...
peddel Posted August 20, 2008 Author Share Posted August 20, 2008 Again after some long testing i found a sollution And its rather easy, just a evolved version of what they suggested me. $sql = "SELECT * FROM $register WHERE dag BETWEEN '$dagB' AND '$dagE' AND maand BETWEEN '$maandB' AND '$maandE' AND jaar BETWEEN '$jaarB' AND '$jaarE'"; Quote Link to comment Share on other sites More sharing options...
fenway Posted August 20, 2008 Share Posted August 20, 2008 "Split the information"? I really hope you're not storing the date as three separate fields.... 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.