note 97627 added to mysqli-result.num-rows

From: Date: Thu, 29 Apr 2010 06:41:51 +0000
Subject: note 97627 added to mysqli-result.num-rows
Groups: php.notes 
Request: Send a blank email to php-notes+get-168773@lists.php.net to get a copy of this message
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 } ?> ---- Server IP: 72.55.140.6 Probable Submitter: 207.161.169.241 ---- Manual Page -- http://www.php.net/manual/en/mysqli-result.num-rows.php Edit -- https://master.php.net/note/edit/97627 Del: integrated -- https://master.php.net/note/delete/97627/integrated Del: useless -- https://master.php.net/note/delete/97627/useless Del: bad code -- https://master.php.net/note/delete/97627/bad+code Del: spam -- https://master.php.net/note/delete/97627/spam Del: non-english -- https://master.php.net/note/delete/97627/non-english Del: in docs -- https://master.php.net/note/delete/97627/in+docs Del: other reasons-- https://master.php.net/note/delete/97627 Reject -- https://master.php.net/note/reject/97627 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#168773) next »