So further to a previous question, I've updated my code to the following
$stmt = $conn->prepare("SELECT count(id) FROM activities WHERE userId = ? AND status = ? AND DATEDIFF('$date', next_due) >= 1");
$stmt->bind_param("ss", $userId, $status);
$stmt->execute();
$stmt->store_result();
$numrows = $stmt->num_rows;
echo $numrows;
It no longer throws an error, but returns $numrows as 1, however I know the number of rows returned should be 2 (I know it should be 2 as I have 2 identical rows in the table for testing purposes). I've tried SELECT count(*)
, but that also throw a 1 at me.