Hi All

I have a pager script like this:

PHP Code:
error_reporting(E_ALL);
require_once("../pager.php");
$p = new Pager;
$limit = 10;
$start = $p->findStart($limit);
require("../../../scripts/db.php");

...

$count = mysql_num_rows(mysql_query("SELECT * FROM mytable"));
$pages = $p->findPages($count, $limit);
$query = "SELECT * FROM coins WHERE myquery LIMIT ".$start.", ".$limit);
$result = mysql_query($query, $connection) or die(mysql_error()); 
if(mysql_num_rows($result)<1)
{
echo "mymessage";
}
$next_prev = $p->nextPrev($_GET['page'], $pages);
?>
<?php
while($display mysql_fetch_array($resultMYSQL_ASSOC))
{
$ID=$display["ID"];

...
?>

<div align="center"><center>
  <table border="0" width="699" bgcolor="#FFFFFF">
    <tr>
      <td valign="top" align="center" width="100"><?php echo $next_prev?></td>
The problem is that even if there is less records in the database than the limit specifies it still gives the NEXT | PREV links and opens the next page with "Undefined Field" errors.

I tried to fix it like so:

PHP Code:
if(mysql_num_rows($result)<1){echo mymessage";}
$next_prev = $p->nextPrev($_GET['page'], $pages);
if(mysql_num_rows($result)>$limit){
echo "
<tr><td width='33%' align='center'><b><font size='3' color='#8D4D4B'></font></b></td>";
echo "
<td width='33%' align='center'><b><font size='3' color='#8D4D4B'></font></b></td>";
echo "
<td width='33%' align='center'><b><font size='3' color='#FFFFFF'>";
$next_prev;
echo "
</font></b></td></tr>";
}
?> 
The problem is that the records display correctly etc BUT there are no NEXT | PREV links...?

Thanx!!