Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem: Listed Page's Numbering

Status
Not open for further replies.

alsaffar

Programmer
Oct 25, 2001
165
KW
Hi there,

I want to know how can I have at the bootom of the page, the numbers of pages thats available from the database's selection.

For example, when you retreive the entries of the guest book, you don't want to list all the entries in one page, you want to list 10 entries/page.

I already did the "Next" and "Prev" links, but how can I do the numbering:

Pages: 1 2 3 4 5 6 7 8 9 10 »

Please feed me back guys.

HaVe a GooD Day ;)

Ali

ali_alsaffar@hotmail.com
 
hi

i was using this one

Code:
$page = (isset($page) && (trim($page) != ''))?$page:1;

$page_count = ceil($record_count/$records_per_page);
$start_page = (($page<5)?1:(($page>($page_count-4))?$page_count-9:($page-4)));
$end_page = (($page<5)?(($page_count<10)?$page_count:10):(($page>($page_count-4))?$page_count:($page+5)));
if (isset($page) && $page!=1) {
	$html_output .= ' <a href=&quot;./result.php?page=1&quot;>|<<</a> ';
	$html_output .= ' <a href=&quot;./result.php?page='.($page-1).'&quot;><</a> ';
	}
for($i=$start_page; $i<=$end_page; $i++)
{
	if ($i == $page) 
		$html_output .= ' '.$i.' ';
	else
		$html_output .= ' <a href=&quot;./result.php?page='.$i.'&quot;>'.$i.'</a> ';
}
if (isset($page) && $page!=$page_count) {
	$html_output .= ' <a href=&quot;./result.php?page='.($page+1).'&quot;>></a> ';
	$html_output .= ' <a href=&quot;./result.php?page='.($page_count).'&quot;>>>|</a> ';
	}

echo $html_output;

hope that helps
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top