I have the following table :
id dateStart dateEnd active
1 2012-11-12 2012-12-31 0
2 2012-11-12 2012-12-31 0
I want to check if today's date is in between dateStart
and dateEnd
.
The following is my query for this :
$todaysDate="2012-26-11";
$db = Zend_Registry::get("db");
$result = $db->fetchAll("SELECT * FROM `table` WHERE active=0 AND {$todaysDate} between dateStart and dateEnd");
return $result;
But so far it's not working as it returns zero rows.
Try this :: This will solve your problem
SELECT * FROM `table` WHERE active=0 AND CURDATE() between dateStart and dateEnd
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With