note 13429 added to function.mysql-fetch-row.php
| From: | jpaulo at fischer dot med dot br | Date: | Sat, 16 Jun 2001 06:18:29 +0000 |
| Subject: | note 13429 added to function.mysql-fetch-row.php | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-14401@lists.php.net to get a copy of this message | ||
Here is a simple and very fast way I use to return results using the foreach construct:
$results = mysql_query($query);
$results_array = mysql_fetch_row($results);
foreach($results_array as $i => $data) {
print "<li>$i: $data";
}
If you don't need the element's key just use:
foreach ($results_array as $data) {
print $data;
}
Regards,
Joao Paulo M. Fischer
http://www.php.net/manual/en/function.mysql-fetch-row.php