Jump to content

Archived

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

jcbarr

Paginate results

Recommended Posts

Okay here is my code

[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>

<? } ?>[/code]

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.

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites

×

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.