You need to transfer the result set from the SELECT
query before calling the ->num_rows()
method.
// your code
$stmt->execute();
$stmt->store_result();
$numRows = $stmt->num_rows;
echo $numRows;
Here's the reference:
- http://php.net/manual/en/mysqli.store-result.php