-1

OK, so I've gone round and round so many times now, I probably can't see the wood for the trees.

I want to return the number of rows that match the WHERE clause. This is my code

          $stmt = $conn->prepare("SELECT id, title, category, last_completed, next_due, assigned_to FROM activities WHERE userId = ? AND status = ? AND DATEDIFF('$date', next_due) >= 1");
          $stmt->bind_param("ss", $userId, $status);
          $stmt->execute();
          $result = $stmt->get_result();
          $num_rows = mysql_num_rows($result);
          echo $num_rows;

I have no doubt the error is obvious, but I can't see it. I can return the number of rows and establish it is more than 0, I just can't echo the num_rows!!!!

1 Answers1

-1

Your connection is oops method. so do with Oops format see the difference https://www.w3schools.com/php/php_mysql_select.asp

$conn->num_rows
prasanth
  • 22,145
  • 4
  • 29
  • 53