Connecting Tech Pros Worldwide Help | Site Map

Creating a Record list with Prev / Next ability

 
LinkBack Thread Tools Search this Thread
  #1  
Old March 13th, 2008, 05:55 AM
wqmmnm
Guest
 
Posts: n/a
Default 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.

  #2  
Old March 13th, 2008, 12:35 PM
Jerry Stuckle
Guest
 
Posts: n/a
Default Re: Creating a Record list with Prev / Next ability

wqmmnm wrote:
Quote:
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.
jstucklex@attglobal.net
==================

  #3  
Old March 13th, 2008, 01:55 PM
PaulB
Guest
 
Posts: n/a
Default Re: Creating a Record list with Prev / Next ability

wqmmnm wrote:
Quote:
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


  #4  
Old March 14th, 2008, 02:55 AM
wqmmnm
Guest
 
Posts: n/a
Default Re: Creating a Record list with Prev / Next ability

On Mar 13, 9:28*am, Jerry Stuckle <jstuck...@attglobal.netwrote:
Quote:
wqmmnm wrote:
Quote:
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
  #5  
Old March 14th, 2008, 07:35 AM
otrWalter@gmail.com
Guest
 
Posts: n/a
Default Re: Creating a Record list with Prev / Next ability

On Mar 13, 5:45 am, wqmmnm <wqm...@gmail.comwrote:
Quote:
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
  #6  
Old March 14th, 2008, 09:25 AM
Guillaume
Guest
 
Posts: n/a
Default Re: Creating a Record list with Prev / Next ability

wqmmnm a écrit :
Quote:
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
  #7  
Old March 14th, 2008, 10:55 AM
Jerry Stuckle
Guest
 
Posts: n/a
Default Re: Creating a Record list with Prev / Next ability

wqmmnm wrote:
Quote:
On Mar 13, 9:28 am, Jerry Stuckle <jstuck...@attglobal.netwrote:
Quote:
>wqmmnm wrote:
Quote:
>>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.
jstucklex@attglobal.net
==================

  #8  
Old March 17th, 2008, 05:35 PM
PaulB
Guest
 
Posts: n/a
Default Re: Creating a Record list with Prev / Next ability

wqmmnm wrote:
Quote:
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


 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.