note 101911 added to function.empty

From: Date: Mon, 17 Jan 2011 20:54:03 +0000
Subject: note 101911 added to function.empty
Groups: php.notes 
Request: Send a blank email to php-notes+get-175841@lists.php.net to get a copy of this message
Since this special case is not mentioned already: the empty() check does not work for mysqli resources / connections stored within a private variable. Instead of if(!empty($this->dbConn->error)){...} you have to use $error = $this->dbConn->error; if(!empty($error)){...} otherwise the condition will not evaluate to true in case a mysqli error is given for the present connection. ---- Server IP: 212.124.37.9 Probable Submitter: 91.34.211.124 ---- Manual Page -- http://www.php.net/manual/en/function.empty.php Edit -- https://master.php.net/note/edit/101911 Del: integrated -- https://master.php.net/note/delete/101911/integrated Del: useless -- https://master.php.net/note/delete/101911/useless Del: bad code -- https://master.php.net/note/delete/101911/bad+code Del: spam -- https://master.php.net/note/delete/101911/spam Del: non-english -- https://master.php.net/note/delete/101911/non-english Del: in docs -- https://master.php.net/note/delete/101911/in+docs Del: other reasons-- https://master.php.net/note/delete/101911 Reject -- https://master.php.net/note/reject/101911 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#175841) next »