fifin04 Posted October 26, 2009 Share Posted October 26, 2009 Hi guy's... I'm totally lost here..because don't have any idea how to make a query for grab record using BETWEEN startdate and enddate since existing record are stored using this format datetime(dd/mm/yyyy hh:mm:ss) but my supplied $startdate and my $enddate are in this format date(dd/mm/yyyy) only....hope someone will shed me some light on this...is it possible to grab those record...?? //example of my query.. $sqlquery = "SELECT * FROM sometable WHERE OFFENCE_NOTICE_STATUS = 'A' AND CREATED_DATE BETWEEN ".$start_date." AND ".$end_date; //can't run this query because of the stored record in database are in different format datetime(dd/mm/yyyy hh:mm:ss) //my supplied variable in date(dd/mm/yyyy) format... Any help are appreciated TQ.. Link to comment https://forums.phpfreaks.com/topic/179038-solved-problem-with-php-mysql-query/ Share on other sites More sharing options...
cags Posted October 26, 2009 Share Posted October 26, 2009 There are other ways of doing it, but one way would be to filp the dates into the right order. $parts = explode('/', $start_date); $start_date = $parts[2] . '/' . $parts[1] . '/' . $parts[0]; Link to comment https://forums.phpfreaks.com/topic/179038-solved-problem-with-php-mysql-query/#findComment-944619 Share on other sites More sharing options...
Garethp Posted October 26, 2009 Share Posted October 26, 2009 Try using http://php.net/manual/en/function.strtotime.php To create your timestamp so that you can use http://php.net/manual/en/function.date.php To make the same format as the dabast one Link to comment https://forums.phpfreaks.com/topic/179038-solved-problem-with-php-mysql-query/#findComment-944621 Share on other sites More sharing options...
fifin04 Posted October 28, 2009 Author Share Posted October 28, 2009 Thanks for the reply guys..I do get manage to solve it...only on matters of strtotime function only tq again Link to comment https://forums.phpfreaks.com/topic/179038-solved-problem-with-php-mysql-query/#findComment-946122 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.