$perpage = 20;
$c = sql_qeury("SELECT count(id) FROM table");
$r = sql_qeury("SELECT * FROM table LIMIT $offset, $perpage");
$count = mysql_fetch_array($c);
$pages = round($count[0] / $perpage);
for ($i = 1; $i <= $pages; $i++)
{
$newoffset = $perpage * $i;
echo "<A HREF=search.php?offset=$newoffset>1</A>,";
}
** UNTESTED, but the logic is there.