xeidor Posted July 17, 2007 Share Posted July 17, 2007 I am trying to create a search function that will allow me to enter two dates and have the result output all the information between those two dates. As I have it set up right now i can enter the start date and the end date and it will give me the information for those two dates but nothing in between. Heres what i have so far for code, I know I'm missing the code that makes it select all the stuff in between the dates but I'm not sure where to start. $date_Recordset1 = "1"; if (isset($_GET['date'])) { $date_Recordset1 = (get_magic_quotes_gpc()) ? $_GET['date'] : addslashes($_GET['date']); } $date2_Recordset1 = "1"; if (isset($_GET['date2'])) { $date2_Recordset1 = (get_magic_quotes_gpc()) ? $_GET['date2'] : addslashes($_GET['date2']); } $query_Recordset1 = sprintf("SELECT * FROM info WHERE date = '%s' OR date = '%s' ORDER BY `date` ASC", $date_Recordset1,$date2_Recordset1); Any help would be appreciated, Thanks Quote Link to comment Share on other sites More sharing options...
jvrothjr Posted July 17, 2007 Share Posted July 17, 2007 $query_Recordset1 = sprintf("SELECT * FROM info WHERE date between '".$date_Recordset1."' and '$".date2_Recordset1."' ORDER BY `date` ASC"); Quote Link to comment Share on other sites More sharing options...
xeidor Posted July 17, 2007 Author Share Posted July 17, 2007 Edit: Got it to work, changed it to: $query_Recordset1 = sprintf("SELECT * FROM info WHERE date between '%s' and '%s' ORDER BY `date` ASC", $date_Recordset1,$date2_Recordset1); Thanks for the help jvrothjr 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.