I’m running this piece of code:
$sql = "SELECT IF(TIMEDIFF(NOW(),last_update) > '02:00:00',1,0) AS morethan FROM products LIMIT 1";
if($stmt = $this->connect->prepare($sql)) {
$stmt->execute();
$stmt->bind_result($result);
$stmt->fetch();
$stmt->close();
} else {
return false;
}
return $result;
I get 0, that means that the difference I’m checking for it wasn’t found ?
Mysql IF works like this:
That you revceive 0 in the result “morethan ” it means that
is false, in other words the timediff is smaller than 02:00:00