note 58989 deleted from function.mysql-fetch-array by philip
| From: | philip@php.net | Date: | Wed, 26 Feb 2014 00:06:43 +0000 |
| Subject: | note 58989 deleted from function.mysql-fetch-array by philip | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-198714@lists.php.net to get a copy of this message | ||
Note Submitter: info at modulotech dot ch
----
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