note 120997 added to mysqli-result.fetch-assoc

From: Date: Thu, 20 Apr 2017 15:27:07 +0000
Subject: note 120997 added to mysqli-result.fetch-assoc
Groups: php.notes 
Request: Send a blank email to php-notes+get-209031@lists.php.net to get a copy of this message
The official example given here breaks a cardinal rule, and should be rectified. while ($row = $result->fetch_assoc())... ...breaks the rule of "assignment in condition". while (($x = $y->getZ()) !== false) or while (($x = $y->getZ()) !== null) ...is the correct syntax. Conditional statements should always check for a boolean ---- Server IP: 72.52.91.14 Probable Submitter: 107.1.238.189 ---- Manual Page -- http://php.net/manual/en/mysqli-result.fetch-assoc.php Edit -- https://master.php.net/note/edit/120997 Del: integrated -- https://master.php.net/note/delete/120997/integrated Del: useless -- https://master.php.net/note/delete/120997/useless Del: bad code -- https://master.php.net/note/delete/120997/bad+code Del: spam -- https://master.php.net/note/delete/120997/spam Del: non-english -- https://master.php.net/note/delete/120997/non-english Del: in docs -- https://master.php.net/note/delete/120997/in+docs Del: other reasons-- https://master.php.net/note/delete/120997 Reject -- https://master.php.net/note/reject/120997 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#209031) next »