I am running a query in php using `mysql_query()` function, but it is returning zero rows, whereas when I run same query in phpMyAdmin I am getting one row. Don't know what is making things wrong. I have made a same table structure on sqlfiddle with the query

`SELECT * FROM cart_discount 
WHERE email_counter < 1 AND 
cart_time BETWEEN '2013-01-31 00:00:00' AND '2013-02-01 23:59:59'`

<http://sqlfiddle.com/#!2/cceb7/4>

Please guide where php is making trouble..

This is how query is generated and executed.

```
$date1 = date('Y-m-d 00:00:00', strtotime(' -1 day')); 
$date2 = date("Y-m-d 23:59:59");

$query = "SELECT *
            FROM cart_discount
            WHERE email_counter < 1
            AND cart_time >= '$date1'
            AND cart_time <= '$date2'";

$ssql = mysql_query($query, $con) or die('Problem running query: ' . mysql_error());

if (mysql_num_rows($ssql) > 0) {
//do something
} else {
echo 'No rows found';
}

```