note 97627 deleted from mysqli-result.num-rows by degeberg
| From: | degeberg@php.net | Date: | Thu, 29 Apr 2010 08:49:07 +0000 |
| Subject: | note 97627 deleted from mysqli-result.num-rows by degeberg | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-168776@lists.php.net to get a copy of this message | ||
Note Submitter: Chad Allard
----
It should be noted that when you try to retrieve $result->num_rows from a query that returns no
rows, instead of having a value of 0, num_rows will be null.
<?php
// foo doesn't ever equal bar
$result = $mysqli->query("SELECT * FROM table WHERE
foo='bar'");
if($result->num_rows == 0){
//this will not be true
}elseif($result->num_rows == NULL){
// this will be true
}
?>