Jump to content

help adding pagination to this script


jester626

Recommended Posts

I have the following script

[code]<?php
define ("NUMCOLS",4);

$res = mysql_query("SELECT * FROM TBL_photos");

$count = 0;
echo "<TABLE border=1>";
while (list($col1, $col2, $col3) = mysql_fetch_row($res)) {
//
    if ($count % NUMCOLS == 0) echo "<TR>\n";  # new row

    echo "<TD><img src=uploads/$col2 /><BR>$col3</TD>\n";
    $count++;

    if ($count % NUMCOLS == 0) echo "</TR>\n";  # end row
}

# end row if not already ended

if ($count % NUMCOLS != 0) {
  while ($count++ % NUMCOLS) echo "<td>&nbsp;</td>";
  echo "</TR>\n";
}
echo "</TABLE>";
?>
[/code]

I am trying to get some sort of pagination (12 images per page) to work with it but everything I have tried has failed thus far.

Can someone give me some pointers on how to make this work?

Thanks

Jester
Link to comment
https://forums.phpfreaks.com/topic/27682-help-adding-pagination-to-this-script/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.