0

How can i format pages in following manner? eg my search results gave me data for 50 pages. then i want this format for pages.

page1 page2 page3 page4 page5 .... page50

also when i click on '....' the result should be returned from page6 and the page listing should be like

page1 .... page5 page6 page7 page8 page9 .... page50

i hope i am clear with my question

ajreal
  • 46,720
  • 11
  • 89
  • 119
Assad Nazar
  • 1,420
  • 5
  • 20
  • 40
  • 1
    What specifically do you want help with? Writing an SQL query that returns results for a specific page? Finding out how many pages there are altogether? Calculating which page numbers should be displayed and which should be replaced by `...`? Creating the HTML and CSS for your page layout? Creating a link that makes a new request? What have you got so far and why doesn't it work? – Mark Byers Nov 22 '10 at 09:40
  • 1
    Take a look of this thread http://stackoverflow.com/questions/267892/how-do-you-implement-pagination-in-php regards. – SubniC Nov 22 '10 at 09:42
  • That's a clever and minimalistic way to solve pagination :-) – Markus Hedlund Nov 22 '10 at 10:04

3 Answers3

0

First calculate total number of records with its search criteria. Then divide it with record per page. So you will get Total Pages to show. say for eg

$total_number_record = 30; 
$record_per_page = 10; 
$total_pages = 30/10; (3) 

Now use loop to show links

for($i=1;$i<=$total_pages;$i++){ 

    echo '<a href=\'search.php?page="'.$i.'"&search="'. $_POST['search'].'">Page '.$i.'</a>';

} 

this will shows link on your web page

Poonam Bhatt
  • 10,154
  • 16
  • 53
  • 72
0

I think you will find all answers on this page:

http://phpeasystep.com/phptu/29.html

0

http://phpeasystep.com/phptu/29.html

Assad Nazar
  • 1,420
  • 5
  • 20
  • 40