473,545 Members | 2,047 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Pagination

Anyone know of a up-to-date tutorial for pagination where I can have it
like:

Prev 1 2 3 4 Next

Thanks.
--
Sharif T. Karim
....you don't know wrath yet...
Jul 17 '05 #1
9 3381
Sharif T. Karim wrote:
Anyone know of a up-to-date tutorial for pagination where I can have it
like:

Prev 1 2 3 4 Next

Thanks.


if you go to google, groups, comp.languages. php and search for
pagination, there was a recent discussion on this topic...

<<
http://groups.google.com/groups?hl=e...hp&btnG=Search


Michael Austin.
Jul 17 '05 #2
Try this for size: http://www.tonymarston.co.uk/php-mysql/pagination.html

--
Tony Marston

http://www.tonymarston.net
"Sharif T. Karim" <sh****@nyc.rr. com> wrote in message
news:Sc******** **********@twis ter.nyc.rr.com. ..
Anyone know of a up-to-date tutorial for pagination where I can have it
like:

Prev 1 2 3 4 Next

Thanks.
--
Sharif T. Karim
...you don't know wrath yet...

Jul 17 '05 #3
"Sharif T. Karim" <sh****@nyc.rr. com> wrote in message news:<Sc******* ***********@twi ster.nyc.rr.com >...
Anyone know of a up-to-date tutorial for pagination where I can have it
like:

Prev 1 2 3 4 Next

Thanks.


My concept of pagination, if it helps, is to perform the following
steps:

1) One single DB call to grab everything at one time that you need to
list
2) Store entire contents of the resultset into a $_SESSION variable
(serialized, of course)
3) Establish a $prev and $next routine with integer values that limit
the amount of display per page and calculate your $prev and $next
4) Upon each click of your "Previous" and "Next" links you will pull
not from the DB but from the serialized $_SESSION variable to ensure
efficiency and data reusability
5) Filter results by $prev and $next to only display the results you
need per page
6) Also allow for a "view all" link if the user wants to see
everything at one time
7) *Important* When you go to view another set of stuff, be sure to
"flush" the cache by destroying the $_SESSION variable to ensure not
having latent results floating around in your $_SESSION cache.

My $0.02

Phil
Jul 17 '05 #4
I noticed that Message-ID:
<1c************ **************@ posting.google. com> from Phil Powell
contained the following:
4) Upon each click of your "Previous" and "Next" links you will pull
not from the DB but from the serialized $_SESSION variable to ensure
efficiency and data reusability


And /is/ that more efficient than separate DB queries?

Curious to know.

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 17 '05 #5
Hi,

You could take a look at:
http://www.phppeanuts.org/site/index...bjectIndexPage
It produces a paged display of instances of a peanuts domain model class
(peanuts) that are loaded from all records from a table.

Building the list of paging buttons is done by a seperate component:
http://www.phppeanuts.org/site/index...stBuilder.html

The acual output of buttons is done by instances of PntButtonsPart and
PntButtonsPanel and the html table by PntTablePart, for code see:
http://www.phppeanuts.org/site/index...rts/parts.html

For a subclass that does searching in the database see:
http://www.phppeanuts.org/site/index...jectSearchPage
It uses a specialized part for generating and processing the search form:
http://www.phppeanuts.org/site/index...FilterFormPart

Or you could simply download the framework and use it,
example:
http://www.phppeanuts.org/examples/e...ler=SearchPage
Greetings,

Henk Verhoeven,
www.phpPeanuts.org.

Sharif T. Karim wrote:
Anyone know of a up-to-date tutorial for pagination where I can have it
like:

Prev 1 2 3 4 Next

Thanks.


Jul 17 '05 #6
Tony Marston, being the foo Tony Marston is, wrote:
Try this for size:
http://www.tonymarston.co.uk/php-mysql/pagination.html


Thanks a lot Tony.

--
Sharif T. Karim
....you don't know wrath yet...
Jul 17 '05 #7
In message-id <pk************ *************** *****@4ax.com>,
Geoff Berrow wrote:
I noticed that Message-ID:
<1c*********** *************** @posting.google .com> from Phil Powell
contained the following:
4) Upon each click of your "Previous" and "Next" links you will pull
not from the DB but from the serialized $_SESSION variable to ensure
efficiency and data reusability


And /is/ that more efficient than separate DB queries?

Curious to know.


dunno about efficiency, but i can certainly see an advantage where the
data being retrieved is constantly changing - above approach provides
the user session with a 'snapshot' of the database a a specific moment
in time.

of course, with many users and large data sets this would become a
major problem, because you'd be creating a new 'copy' of the data for
every user session, which would need to be stored on disk.

hc.

Jul 17 '05 #8
Geoff Berrow <bl******@ckdog .co.uk> wrote in message news:<pk******* *************** **********@4ax. com>...
I noticed that Message-ID:
<1c************ **************@ posting.google. com> from Phil Powell
contained the following:
4) Upon each click of your "Previous" and "Next" links you will pull
not from the DB but from the serialized $_SESSION variable to ensure
efficiency and data reusability


And /is/ that more efficient than separate DB queries?

Curious to know.


For what I wrote, very much so, yes! Using timing techniques on
pages, the initial run of a listing query took the page download time
to average 1.5 - 2.0 seconds. Upon clicking "Next" (and then
subsequently clicking "Prev" or whatever) each page download time
decreased significantly, going to 0.1 - 0.5 seconds per iteration,
since it was delivering from $_SESSION instead of db query.

Phil
Jul 17 '05 #9
Herbie Cumberland <no**********@n on-existant.tld> wrote in message news:<42******* *************** **********@4ax. com>...
In message-id <pk************ *************** *****@4ax.com>,
Geoff Berrow wrote:
I noticed that Message-ID:
<1c*********** *************** @posting.google .com> from Phil Powell
contained the following:
4) Upon each click of your "Previous" and "Next" links you will pull
not from the DB but from the serialized $_SESSION variable to ensure
efficiency and data reusability
And /is/ that more efficient than separate DB queries?

Curious to know.


dunno about efficiency, but i can certainly see an advantage where the
data being retrieved is constantly changing - above approach provides
the user session with a 'snapshot' of the database a a specific moment
in time.

of course, with many users and large data sets this would become a
major problem, because you'd be creating a new 'copy' of the data for
every user session, which would need to be stored on disk.


Ay and there's the advantage of what I built being that it's a
single-user internal application, that would mean only one 'copy'
would exist since there would be only one user session stored on disk.

Phil


hc.

Jul 17 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1748
by: Faree | last post by:
I am workign on a news portal which needs paginaiton as usual.but all the code i got depends on the number of records that will come from database :( .it is working well too. But i need pagination depends on the number of rows or number characters in a variable.for example if there are more than 100 characters in that it should be display...
1
5805
by: Kruq | last post by:
Is it possible to use pagination with DataList? Can't find it.. :( Kruq
2
2301
by: Chris H | last post by:
I am having a problem with pagination, basically the problem is happening in the "PREV / NUMBERS / NEXT" links, it appears as if the reason is becasue the increment and decrement operators aren't functioning or the $page variable isnt working in that part of the code... Below is the link to the working but broken page.. as well as the main...
11
2746
by: ste | last post by:
Hi there, Further to my recent posts where I've received excellent help from Rik and Jerry, I've ended up with an image gallery on my website that displays images in a table, 3 images per row. This works great and opens all images in the database when I open the url mywebsite/gallery.php, or I can choose certain images (by category) by...
1
7398
by: dhanu | last post by:
How to manage pagination in AJAX? My requirement is similar to GMails inbox feature. Whenever a new mail comes in,the newly arrived mail is at the start of my inbox and last row in that page goes to next page(ie Pagination happens automatically without any page refresh). I have used ajaxdisplay tag library from Source Forge which does...
1
6838
by: shalini jain | last post by:
Hi, I want to know how can we do pagination using XSL. There are number of tutorials available on pagination using PHP but nothing with XSL. i am really stuck with my code. Below is the code that i have written for pagination but it displays the link of all the pages at one go i.e. if i have 8 pages showing 10 results per page than it shows...
16
2748
by: gnawz | last post by:
I have a pagination function I am using in a file called functions.php as below<? //Pagination functions function getPagingQuery($sql, $itemPerPage = 10) { if (isset($_GET) && (int)$_GET > 0) { $page = (int)$_GET; } else { $page = 1; } // start fetching from this row number $offset = ($page - 1) *...
4
3559
by: ArizonaJohn | last post by:
Hello, The code below works great. The user enters a name into an HTML form, the code looks up a table with that name, and then that table is displayed. I am trying to use pagination with it, and the pagination almost works. The first page of the pagination works fine, but when I click on one of the links for one of the next pages, the...
2
2584
by: kkshansid | last post by:
this is my search page on which i am getting two parameters from previous page but the problem is that as soon as i click any other next pages my sql query fails as it doesnt get these two parameters kindly help <?php session_start(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"...
0
7475
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7918
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7436
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7766
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5341
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4958
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3463
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1897
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
715
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.