$limit = 20;
if (!$offset)
{
$offset = 0;
}
function pagenav()
{
global $limit,$offset,$numpage,$where;
if ($where)
{
$safewhere=urlencode($where);
}
echo "<TABLE CELLPADDING=0 BORDER=0 CELLSPACING=5 WIDTH=100% align=\"center\"><tr> </tr><TR align=center><TD ALIGN='center'>";
if ($offset>=$limit)
{
$newoff=$offset-$limit;
echo "<A HREF=\"$PHP_SELF?offset=$newoff\">Prev</A>";
}
else
{
echo "PREV";
}
echo "<font size=2><b> </b></font> ";
for ($i=1;$i<=$numpage;$i++)
{
if ((($i-1)*$limit)==$offset)
{
print "$i ";
}
else
{
$newoff=($i-1)*$limit;
echo "<A HREF=\"$PHP_SELF?offset=$newoff\">
$i</A>";
}
}
echo " ";
if ($offset!=$limit*($numpage-1) && $offset=="NULL")
{
$newoff=$offset+$limit;
echo "<A HREF=\"$PHP_SELF?offset=$newoff\">next</A></TD>";
}
else
{
echo "NEXT";
}
echo "</TR></TABLE>";
} // END FUNCTION
Use the above function to extract the results. remember to put $limit value in select SQL statement along with offset
Have a great coding...