Ok, i just have a short question: Your $sqlsearch is used both for displaying the results from the search and making the page numbers in the bottom, or you use it ONLY to create the page numbers on the bottom of your search page.
I would suggest you the following:
You should have 2 querries - one responsible for retrieving the search results, and one dedicated for the page numbers only.
Your display query should look something like:
if (!isset($current_page))
{
$current_page=1;
}
SELECT a.* b.8 FROM a, b WHERE .... LIMIT ($omit_records, $display_this_number_per_page);
Where $display_this_number_per_page = 10; ( e.g. you want to show 10 records on your page)
and $omit_records= $display_this_number_per_page * $current_page;
The second query will take care of the page numbers only.
It should look something like
SELECT a.* b.8 FROM a, b WHERE (whatever you like);
Note that there is no limit clause in the select statement, wich will return always the total number of records. You need to count this number of records in order to create the number of pages. So
$total_records = count(mysql_num_rows(query));
if (($total_records % $display_this_number_per_page)==0)
{
$total_pages = $total_records / $display_this_number_per_page;
}
else
{
$total_pages = ($total_records / $display_this_number_per_page)+1;
}
Then you have to display your page numbers
for($i=0;$i<$total_pages;$i++)
{
echo '<a href="?current_page="'.$i.'">'.$i.'</a>';
}
So, in short this should look like this:
e.g. you have 45 records in your db. You want to show 10 records per page, and you want to show the page numbers for quick selection, the bottom line should look like
1 | 2 | 3 | 4 | 5