If I use this in PHP to count records, it gives a count of 1 when there are, in fact, no records. However, when I run the same query in HeidiSQL, phpmyadmin or any other, it gives the proper 0. Why the discrepancy?
if ($result = $mysqli->query($Query)) :
return $result->num_rows;
$MySQLError = ($mysqli->connect_errno) ? mysqli_error($mysqli) : "";
$result->close();
$mysqli->close();
if ($MySQLError) return $MySQLError;
endif;
$Query, in this case, contains:
SELECT COUNT(ID) AS UpdateCount
FROM tablename
WHERE ShowPage = 1 AND
DateUpdated BETWEEN 1554345942 AND 1554950742