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.. Quote 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]; Quote 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 Quote 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 Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.