473,473 Members | 1,853 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Creating a Record list with Prev / Next ability

How do I create an html list using php and mysql that also has the
previous and next funtionality.
Mar 13 '08 #1
7 1916
wqmmnm wrote:
How do I create an html list using php and mysql that also has the
previous and next funtionality.
You need to determine how many items are in the list and remember where
you are in the list.

The list comes from somewhere - i.e. a database, flat file, etc. You
can determine from that how many items are in the list. Start with the
current position as 0 and keep track of it (i.e. in a session variable).

When they press next, increment the current position until you reach the
end of the list. If they press prev, decrement the current position
until you reach the beginning of the list. Then display the item at
that position in the list.

If you're displaying multiple items on a page, the current position
becomes the page number and you just need to account for the fact you
have 8 (or however many) items per page instead of 1.

From your question, it's hard to give you any more specific information.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Mar 13 '08 #2
wqmmnm wrote:
How do I create an html list using php and mysql that also has the
previous and next funtionality.
What like this? http://www.greenhithe.org.uk/php/allfr_a.php

If so I can give you the code.

Paul
--
Add an underscore after the p to reply
Mar 13 '08 #3
On Mar 13, 9:28*am, Jerry Stuckle <jstuck...@attglobal.netwrote:
wqmmnm wrote:
How do I create an html list using *php and mysql that also has the
previous and next funtionality.

You need to determine how many items are in the list and remember where
you are in the list.

The list comes from somewhere - i.e. a database, flat file, etc. *You
can determine from that how many items are in the list. *Start with the
current position as 0 and keep track of it (i.e. in a session variable).

When they press next, increment the current position until you reach the
end of the list. *If they press prev, decrement the current position
until you reach the beginning of the list. *Then display the item at
that position in the list.

If you're displaying multiple items on a page, the current position
becomes the page number and you just need to account for the fact you
have 8 (or however many) items per page instead of 1.

*From your question, it's hard to give you any more specific information..

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================
Okay how do I keep track of the records that I am on after I hit next
or previous links. Do I use a hidden variable and just capture it use
GET or POST methods. My biggest things is how do you keep track of
what record you are on now to determine what the next records should
be.

Thanks,

Walter Q. Mason III
Mar 14 '08 #4
On Mar 13, 5:45 am, wqmmnm <wqm...@gmail.comwrote:
How do I create an html list using php and mysql that also has the
previous and next funtionality.
I had the same issue to solve.

PEAR/Pager

Works like dream! The NEXT/PREVIOUS needs a little "help" to look like
i want, but that's a minor details.

And here's a great example/tutorial on how to use it!

http://devzone.zend.com/article/2418...ith-PEAR-Pager

Walter
Mar 14 '08 #5
wqmmnm a écrit :
Okay how do I keep track of the records that I am on after I hit next
or previous links. Do I use a hidden variable and just capture it use
GET or POST methods.
A simple $start using GET is enough. Your script includes the number of
items (or it also can be a GET variable), you display X items from
$start, next page is $start + x, previous is $start - x, check for the
max value (and don't display next), check for the min value (if $start =
0 - and don't display previous)

--
Guillaume
Mar 14 '08 #6
wqmmnm wrote:
On Mar 13, 9:28 am, Jerry Stuckle <jstuck...@attglobal.netwrote:
>wqmmnm wrote:
>>How do I create an html list using php and mysql that also has the
previous and next funtionality.
You need to determine how many items are in the list and remember where
you are in the list.

The list comes from somewhere - i.e. a database, flat file, etc. You
can determine from that how many items are in the list. Start with the
current position as 0 and keep track of it (i.e. in a session variable).

When they press next, increment the current position until you reach the
end of the list. If they press prev, decrement the current position
until you reach the beginning of the list. Then display the item at
that position in the list.

If you're displaying multiple items on a page, the current position
becomes the page number and you just need to account for the fact you
have 8 (or however many) items per page instead of 1.

From your question, it's hard to give you any more specific information.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================

Okay how do I keep track of the records that I am on after I hit next
or previous links. Do I use a hidden variable and just capture it use
GET or POST methods. My biggest things is how do you keep track of
what record you are on now to determine what the next records should
be.

Thanks,

Walter Q. Mason III
You could use hidden either hidden or session variables or a cookie.
For something like this, I'd probably just use a hidden variable, but
any of them will work.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Mar 14 '08 #7
wqmmnm wrote:
How do I create an html list using php and mysql that also has the
previous and next funtionality.
http://www.allsyntax.com/tutorials/P...with-PHP/1.php

Found this while looking for good newbie tutorials.

Paul
--
Add an underscore after the p to reply
Mar 17 '08 #8

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

Similar topics

8
by: AR John | last post by:
Hi Everyone, I was developing a browser based software and one of the features of that software is that it will search some products with some matching criteria and the result will be displayed...
23
by: Fuzzyman | last post by:
Pythons internal 'pointers' system is certainly causing me a few headaches..... When I want to copy the contents of a variable I find it impossible to know whether I've copied the contents *or*...
7
by: chirag | last post by:
hi i have following code. i m confused about where do i write p-> next =NULL once user enters -1 to exit. help is appriciated. because what i have right now it sets = NULL after the first integer....
1
by: saturnius | last post by:
Hi, I would like to have a navigation menu with prev/next in a top frame and in the main frame a PDF file. I think this might be possible with JavaScript: - get current file name - go to next...
6
by: Patrick Coghlan | last post by:
I want to create about 4 forms with the same dimensions and background colours, similar to the forms one has to traverse when installing various software packages. I'm using Visual Studio and...
1
by: Stanley | last post by:
Ok I am building a calendar in my code and when it is rendered I use the DayRender event to add links to each day. However, I can't seem to find a way to build links for the Prev and Next month...
3
by: Darren | last post by:
Dear Groups I've used paging with a datagrid in C# at least a hundred times, but for whatever reason, I cannot get the prev /next to appear as links. It is absolutely certain that the number of...
6
by: AA Arens | last post by:
Hi, I have a database with 2 main forms. Contacts and companies. I share the base with two others via LAN. On the companies form I have buttons to navigate throught the records (>400). We are...
2
by: JRal | last post by:
I am attempting to create a list of selected names from an MS Access database but do not want to edit the database. I am trying to use a combo box field in a subform list to select the names I want...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
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...
0
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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...

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.