How to compute previous and next buttons?


 
Thread Tools Search this Thread
Top Forums Web Development How to compute previous and next buttons?
# 1  
Old 09-20-2010
How to compute previous and next buttons?

I have a project to migrate my club's membership database from Access to web based using MySQL/PHP, but I have a problem I can't get my head around and would appreciate some help...
Background...
I want to be able to display each member's data on screen and add a Previous and Next button to move the display to the next member in the list, with an order based on member's LastName, FirstName (and some other fields).
Creating the order to display is easy..
Code:
select MemberId
from Member 
order by LastName, FirstName, Title, MemberId

and then I can display a specific record with
Code:
select * from Member where MemberId=<...>

...but how do I determine the member ID for the next record when I'm displaying one record. So, if I'm, say, 30 records in, how do I know the Member ID of the 29th (previous) and 31st (next) record.

To clarify, let's assume that the sorted MemberId order is
Code:
17
25
8
42
40
...

Assuming I'm displaying the values of ID=8 on the page, what do I need to compute to enter 25 in the previous button and 42 in the next?

Hope that's clear.
# 2  
Old 09-20-2010
Check out the LIMIT clause. See the MySQL documentation for details.
# 3  
Old 09-21-2010
That might do the trick - thanks.
Login or Register to Ask a Question

Previous Thread | Next Thread

4 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Remove previous line if next & previous lines have same 4th character.

I want to remove commands having no output. In below text file. bash-3.2$ cat abc_do_it.txt grpg10so>show trunk group all status grpg11so>show trunk group all status grpg12so>show trunk group all status GCPKNYAIGT73IMO 1440 1345 0 0 94 0 0 INSERVICE 93% 0%... (4 Replies)
Discussion started by: Raza Ali
4 Replies

2. Web Development

buttons links in frame

Happy X-Mas to all members... Hi, I have one html file page1.html as below <HTML> <HEAD> <TITLE>Utilities</TITLE> </HEAD> <FRAMESET ROWS="5%,95%"> <FRAME SRC="frames1.html" NAME=SIDEBAR> <FRAME SRC="frames2.html" NAME=SAMPLE> </FRAMESET> </HTML> ... (0 Replies)
Discussion started by: villain41
0 Replies

3. UNIX Desktop Questions & Answers

Buttons and menues like win95

I'v got some question about x managers. I'm using FreeBSD7 + Gnome + fluxbox. when i'm trying to apply some themes, it doesn't look like it should be. All my buttons and menus are look like win95). Whaat kind of lib i should install... what should i do? Here is two printscreens. For ex. My... (1 Reply)
Discussion started by: Levenson
1 Replies

4. Shell Programming and Scripting

replace buttons with hyperlinks

I have a script that uploads file push buttons, but i want to replace buttons with hyperlinks. Please send suggessions Thanks (1 Reply)
Discussion started by: handshakeit
1 Replies
Login or Register to Ask a Question