note 94602 added to mysqli-result.fetch-assoc

From: Date: Fri, 13 Nov 2009 19:43:25 +0000
Subject: note 94602 added to mysqli-result.fetch-assoc
Groups: php.notes 
Request: Send a blank email to php-notes+get-162876@lists.php.net to get a copy of this message
/* fetch associative array works inside a while loop */ while ($row = $result->fetch_assoc()) { printf ("%s (%s)\n", $row["Name"], $row["CountryCode"]); } // works /* fetch associative array doesn't work inside a foreach */ foreach($result->fetch_assoc() as $row) { printf ("%s (%s)\n", $row["Name"], $row["CountryCode"]); } // fails ---- Server IP: 69.147.83.197 Probable Submitter: 70.182.52.98 ---- Manual Page -- http://www.php.net/manual/en/mysqli-result.fetch-assoc.php Edit -- https://master.php.net/note/edit/94602 Del: integrated -- https://master.php.net/note/delete/94602/integrated Del: useless -- https://master.php.net/note/delete/94602/useless Del: bad code -- https://master.php.net/note/delete/94602/bad+code Del: spam -- https://master.php.net/note/delete/94602/spam Del: non-english -- https://master.php.net/note/delete/94602/non-english Del: in docs -- https://master.php.net/note/delete/94602/in+docs Del: other reasons-- https://master.php.net/note/delete/94602 Reject -- https://master.php.net/note/reject/94602 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#162876) next »