[thelist] php output

Richard Harb rharb at earthling.net
Sun Sep 19 11:10:42 CDT 2004

-----Original Message-----
From: Mark Groen
Sent: Sunday, September 19, 2004, 3:18:38 PM
> I have a php web page displaying the results of a db table query using
> while($row = mysql_fetch_row($mysql_result)) and want to add in every
> few rows a "to top" link to the list of items returned.

One way of doing this would be:

$i = 0;
$to_top_after = 5; // number of rows
while (...)
    if ( ($i % $to_top_after) == ($to_top_after - 1) ) {
        echo '<a href="#top">Back to top</a>';

... or some such


> Not sure how to go about this, tried using while, foreach,
> mysql_numrows but not getting anywhere. Is this better achieved
> somehow through the db query maybe?  Can anyone point me to some
> sample code or a tute for something like this?
> cheers,

>        Mark

More information about the thelist mailing list