473,545 Members | 1,998 Online
Bytes | Software Development & Data Engineering Community
+ 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 1927
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*******@attgl obal.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...@attg lobal.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...@attgl obal.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.c omwrote:
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...@attg lobal.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...@attg lobal.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*******@attgl obal.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
3772
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 the product names as a links. Sometimes I got few thousands of product names and I want to show 30 items at a time using html. I was using MySql as...
23
40594
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* just created a new pointer to the original value.... For example I wanted to initialize a list of empty lists.... a=, , , , ] I thought there...
7
2645
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. #include <iostream> #include <cassert> using std::cin; using std::cout;
1
1887
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 prev in the list of 10 files Unfortunately I do not know JavaScript - that's why my post.... ;-) Could anybody point me in the right direction...
6
2227
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 C++ (changing to C# soon) and can create separate forms, but I really just want to clone the first one, have the user select different options on each...
1
2282
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 text. Anyone know how to get to those from code? Stanley
3
1444
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 records exceed the page size. Code is as follows: <asp:datagrid id="grdStores" runat="server" allowpaging="True"
6
2731
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 mostly handling let say 5 companies. Every time I have to navigate or choose the find record button to get the right company. I am looking fo a...
2
1276
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 in a similar way to entering lists of bound names. The problem I have is that unlike a bound list where a new record row becomes available...
0
7473
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
7406
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7813
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
7431
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
7761
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...
0
4949
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
3444
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1888
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
709
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.