Jump to content


Photo

Paginate results


  • Please log in to reply
1 reply to this topic

#1 jcbarr

jcbarr
  • Members
  • PipPipPip
  • Advanced Member
  • 219 posts

Posted 14 April 2006 - 08:41 PM

Okay here is my code

<? include("header.php") ?>

<div class="two" id="news" style="position: absolute; left: 290px; top: 315px; height: 538px; width: 500px; padding: 1.5em;">

<? include("db.php") ?>
<?
$id=$_GET['id'];

 if (!isset($id)){ ?>
<table border=0 align=left>
<?
$sql="SELECT * FROM promos ORDER BY id DESC";
$query=mysql_query($sql);
while ($p=mysql_fetch_array($query)) {
echo "<tr><td class=one valign=top>";
echo "<img src=images/rp/";
echo $p['username'];
echo ".jpg align=left>";
echo "<a class=one href=promos.php?id=";
echo $p['id'];
echo "> ";
echo $p['title'];
echo "</a><br>";
echo "  Promo #";
echo $p['id'];
echo "<br>";
echo "  By: ";
echo $p['author'];
echo "</td></tr>"; }
?>
</table>

<? } ?>

My question is, is there any simple way to paginate this sort of output? Like show 20 entries on one page, and have a link to the next page to show the next 20 and so on?

I have seen a few posts on this, but I am still having problems figure this one out.

Thanks in advance for the help.

#2 litebearer

litebearer
  • Members
  • PipPipPip
  • Advanced Member
  • 2,357 posts
  • Locationwhite lake michigan

Posted 14 April 2006 - 10:34 PM

There is a tutorial for that here on PHPFreaks

[a href=\"http://www.phpfreaks.com/tutorials/73/0.php\" target=\"_blank\"]http://www.phpfreaks.com/tutorials/73/0.php[/a]

Lite...

all the brothers were valiant!

[br][br]The truely intelligent people are not those who create the dots; rather they are they ones with the ability to connect the dots into a coherent picture




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users