Check if the current date is between two dates + mysql select query

Posted by kj7 on Stack Overflow See other posts from Stack Overflow or by kj7
Published on 2012-11-26T10:56:51Z Indexed on 2012/11/26 11:03 UTC
Read the original article Hit count: 134

Filed under:
|
|

I have 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 compare todays date in between dateStart and dateEnd.

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 its not working. Any solution. Thanks in advance.

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql