note 77222 added to function.mysql-num-rows
| From: | deaggi at deaggi dot net | Date: | Mon, 20 Aug 2007 19:45:27 +0000 |
| Subject: | note 77222 added to function.mysql-num-rows | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-129649@lists.php.net to get a copy of this message | ||
In Reply to the last post: This may not always work correctly, as $object->doesExist would
contain a result, not a boolean value. A better way (using the same method) would be using a cast:
<?php
class Object {
var $doesExist = false;
[...]
function load() {
$result = mysql_query('...');
$this->doesExist = (bool) ($res = mysql_fetch_array($result))
[...]
}
}
?>
johannes
----
Server IP: 69.147.83.197
Probable Submitter: 89.13.52.150
----
Manual Page -- http://www.php.net/manual/en/function.mysql-num-rows.php
Edit -- https://master.php.net/note/edit/77222
Del: integrated -- https://master.php.net/note/delete/77222/integrated
Del: useless -- https://master.php.net/note/delete/77222/useless
Del: bad code -- https://master.php.net/note/delete/77222/bad+code
Del: spam -- https://master.php.net/note/delete/77222/spam
Del: non-english -- https://master.php.net/note/delete/77222/non-english
Del: in docs -- https://master.php.net/note/delete/77222/in+docs
Del: other reasons-- https://master.php.net/note/delete/77222
Reject -- https://master.php.net/note/reject/77222
Search -- https://master.php.net/manage/user-notes.php