Jump to content

Recommended Posts

Howdy,

I'm trying to implement some form of page system into a list. Currently, the list is drawing information from a table and listing it. I would like to be able to list this data on different pages, to make it easier on the eyes aswell as when there is alot of information being listed.

 

I've gotten part of the way there...

 

$numcrnt = $numcurrent / 10;
                                  $pages = ceil($numcrnt);
                                  echo "<b>Page</b> ";                                  
                                  for ($i = 1; $i <= $pages; $i++){
                                  echo $i." ";
                                  }

 

$numcurrent is the number of rows within the table which will be listed on the page. They are listed in order of their ID number, which is an auto_number allocated via the DB. The numbers won't necessarily be in sequential order. I want 10 items per page, maximum.

 

This piece of code is providing me with the correct number of pages which I will need for the current list. I'm just stuck as how to do it.

 

I was thinking that each number would link to the page: ticket.php?step=current&start=X

X being 10 multiplied by the page number.

 

Then I was thinking I would select only items (X-9) to X from the table using a mysql query.

 

So, if it were page 3, it would be start=30 (3*10) and it would select items 21 to 30 from the table using a query. Only, I'm not too sure on how to do this.

 

Would greatly appreciate any help.

 

Regards,

Luke

Link to comment
https://forums.phpfreaks.com/topic/147784-implementing-pages-into-a-list/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.