Hello,
are you sure this line is okay:
$PHP_SELF = $_SERVER['search.php'];
using a math.php index makes no sense!
I haven't got very deep in the code, however in general a basic aproach is this:
get row count
produce #(row count)/(results per page) numberd href links, 1,2,3 etc
at every link pass the starting number, for example ...&pg_number=7 means that you start getting results from the 7*(results per page) sql record line
if you want to use previous and next pass on them too the starting number which follows from the previous one. For example: if previous one was 4 it goes <a href...etc &pg_number=3 > for previous
one way to go is to use seek. Check out this very simple example and adopt the seek function to your needs:
<?php
$link = mysql_connect('localhost','root','');
mysql_select_db('mysql', $link);
$result = mysql_query(" select * from `user` order by `host`; ");
echo 'This is the 3d line:<br>' ;
mysql_data_seek($result, 2);
$row = mysql_fetch_row($result);
echo '<b>host:</b> ', $row[0], ' <b>user:</b> ', $row[1],'<br>';
?>
What is more, these things are better done with xmlhttp, give it a try some day! Good ajax is worth it!