I got the following sql:
SELECT COUNT(pu_id) FROM purchasing WHERE MONTH(pu_create_date)=MONTH(NOW())
In Mysql it gives the result 0 as expected.
When I put it in PHP I get the result 1 of $numMonth. This is the php code:
$database = new Database();
$db = $database->getConnection();
$stmt= $db->query('SELECT COUNT(pu_id) FROM purchasing WHERE MONTH(pu_create_date)=MONTH(NOW())') ;
$numMonth = $stmt->execute();
echo $numMonth;
Why do I get two different results?
pu_id = unique key
pu_create_date = timestamp
1istrueas it is thebooleanresponse from theexecutemethod