note 98062 added to function.mysql-fetch-array

From: Date: Mon, 24 May 2010 06:05:20 +0000
Subject: note 98062 added to function.mysql-fetch-array
Groups: php.notes 
Request: Send a blank email to php-notes+get-169546@lists.php.net to get a copy of this message
I observed that whilst using Wampserver on Windows (Apache 2.2.11, PHP 5.3.0, MySQL 5.1.41) if I were to do: <?php while ($row = mysql_fetch_array(mysql_query("SELECT * FROM cats")) { echo $row['Kitty']; } ?> It would only echo one row repeatedly, but if I were to do: <?php $q = mysql_query("SELECT * FROM alliances"); while ($row = mysql_fetch_array($q)) { echo $row['Kitty']; } ?> It would work fine! Just a reminder to anyone who forgets! ---- Server IP: 69.147.83.197 Probable Submitter: 86.63.34.111 ---- Manual Page -- http://www.php.net/manual/en/function.mysql-fetch-array.php Edit -- https://master.php.net/note/edit/98062 Del: integrated -- https://master.php.net/note/delete/98062/integrated Del: useless -- https://master.php.net/note/delete/98062/useless Del: bad code -- https://master.php.net/note/delete/98062/bad+code Del: spam -- https://master.php.net/note/delete/98062/spam Del: non-english -- https://master.php.net/note/delete/98062/non-english Del: in docs -- https://master.php.net/note/delete/98062/in+docs Del: other reasons-- https://master.php.net/note/delete/98062 Reject -- https://master.php.net/note/reject/98062 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#169546) next »