Hi Ajay,
Thanks for the quick response. Your solution sort of works. The numbering updates on each page up to somewhere between pages 12-14. When selecting [Next Page] or [End] for the last page of the results, the numbering seems to skip and lists the last results as 181-194. So far I have 209 names in the database (14 pages).
There has to be a better solution... It's now 5am and I'm sooo burned out on this.
In reference to your question on how I am displaying # records per page, I declared the limit in a string in an include:
$records_per_page = "15";
then:
$query = "SELECT COUNT(*) FROM $tblusers WHERE userlevel <= 3";
$result = mysql_query($query);
$query_data = mysql_fetch_row($result);
$ttl_users = $query_data[0];
$page_num = $cur_page + 1;
$total_num_page = $last_page_num = ceil($ttl_users/$records_per_page);
html_header();
echo "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\">\n"
."<tr valign=\"top\">\n"
."<td nowrap><b>$ttl_users users found</b></td>\n"
."<td align=\"right\" height=\"25\" nowrap>Displaying page $page_num of $last_page_num</td>\n"
."</tr>\n"
."</table>\n";
$limit_str = "LIMIT ". $cur_page * $records_per_page . ", $records_per_page";
$query = "SELECT userID, username, surname, fname, city, state
FROM $tblusers
WHERE userlevel <= 3
$order_by_str $sort_order_str $limit_str";
$result = mysql_query($query);
Is my answer somewhere in this whole mess? Any additional help and/or suggestions are appreciated. Thanks.
Arleen.
Ajay wrote:
Hi Arleen,
I am wondering how you are displaying 15 records per page(Just curious)
because i couldn't find any such in you query or while displaying the result....Anyway your job is pretty simple.
You have the page number in $cur_page variable isn't it use that to get the starting number ($i is not "0" always)
use this
if(!$cur_page){$cur_page=1;}
$i=($cur_page-1)*15;
Hope this works......