[thelist] php/mysql/html - best way to loop data

Tom Dell'Aringa pixelmech at yahoo.com
Mon Aug 4 14:27:48 CDT 2003


--- Peter Lowe <pgl at instinct.org> wrote:
> Here's how I would do it:
> 
> <? while ($listing = mysql_fetch_array($result, MYSQL_ASSOC)) { ?>
> 
> <tr>
> <td><?=$listing['title']?></td>
> <td><?=$listing['category']?></td>
> <td><?=$listing['actor_1']?></td>
> <td><?=$listing['actor_2']?></td>
> <td><img src="images/<?=$listing['rating']?>_star.gif"></td>
> </tr>
> 
> <? } ?>

This is a really nice way to loop through a result set. Is there a
"best practice" for this? I have been using the mysql_fetch_array()
but not quite like this. Just curious.

Tom

=====
http://www.pixelmech.com/ :: Web Development Services
http://www.DMXzone.com/ :: Premium Content Author / JavaScript / Every Friday!
http://www.maccaws.com/ :: Group Leader
[Making A Commercial Case for Adopting Web Standards]

"That's not art, that's just annoying." -- Squidward


More information about the thelist mailing list