jbrill Posted July 12, 2007 Share Posted July 12, 2007 I have two dates in a form " startdate" and enddate" when i display the results i would like to show all results between, and including the two dates. how do i do this... this is my current query: My Variables: $userid = $_GET['idr']; $fromdate = $_GET['fromdate']; $todate = $_GET['todate']; The query: $result = mysql_query("SELECT date, status, time, notes FROM timeclock WHERE userid='".$userid."' ORDER BY time"); Link to comment https://forums.phpfreaks.com/topic/59599-how-do-i-display-all-database-entries-between-two-dates/ Share on other sites More sharing options...
jbrill Posted July 12, 2007 Author Share Posted July 12, 2007 anyone? Link to comment https://forums.phpfreaks.com/topic/59599-how-do-i-display-all-database-entries-between-two-dates/#findComment-296157 Share on other sites More sharing options...
JasonLewis Posted July 12, 2007 Share Posted July 12, 2007 my mysql querying isnt the greatest but try this: $result = mysql_query("SELECT date, status, time, notes FROM timeclock WHERE userid='".$userid."' AND date BETWEEN {$fromdate} AND {$todate} ORDER BY time"); but your date formats have to be the same, i think. hope that helps. Link to comment https://forums.phpfreaks.com/topic/59599-how-do-i-display-all-database-entries-between-two-dates/#findComment-296459 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.