cyprus Posted September 23, 2006 Share Posted September 23, 2006 I have a series of checkboxes on a page/form which allows the user to dynamically build a WHERE statement.$where = "WHERE GGroup IN ('$prodlist')";Is it possible to add into the above a where condition to select records between two dates? Many thanks. Link to comment https://forums.phpfreaks.com/topic/21818-adding-fromto-dates-on-where-select-query/ Share on other sites More sharing options...
onlyican Posted September 23, 2006 Share Posted September 23, 2006 something like[code]<?php$from_date = "2006-01-01";$to_date = "2006-09-24";$query = "SELECT * FROM table WHERE date_added BETWEEN '".$from_date."' AND ".$to_date."'";?>[/code] Link to comment https://forums.phpfreaks.com/topic/21818-adding-fromto-dates-on-where-select-query/#findComment-97435 Share on other sites More sharing options...
cyprus Posted September 24, 2006 Author Share Posted September 24, 2006 Many thanks, that sorted it. Regards Link to comment https://forums.phpfreaks.com/topic/21818-adding-fromto-dates-on-where-select-query/#findComment-97574 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.