note 58989 added to function.mysql-fetch-array
| From: | info at modulotech dot ch | Date: | Wed, 23 Nov 2005 10:37:15 +0000 |
| Subject: | note 58989 added to function.mysql-fetch-array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-98969@lists.php.net to get a copy of this message | ||
I think using a for loop to display fetched rows from a table is more convenient than a while loop,
since one have directely access to the record number:
$reclist = mysql_query("SELECT field FROM table",$db)
or die(mysql_errno()." : ".mysql_error());
for ($j=0; $rec=mysql_fetch_array($reclist); $j++){
printf("%s - %s<br>\n",$j,$rec["field"]);
}
Hope this is usefull. Ali
----
Manual Page -- http://www.php.net/manual/en/function.mysql-fetch-array.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+58989
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+58989&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+58989&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+58989&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+58989&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+58989&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+58989&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+58989&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+58989&report=yes
Search -- http://master.php.net/manage/user-notes.php