Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to retrieve the data from mysql?

Status
Not open for further replies.

alan123

MIS
Oct 17, 2002
149
US
I'm using php to embed mysql code, on each page I want to show all information for the same dept:

SELECT * FROM $table where DEPT='$dept' LIMIT 1

Now I want to have two links (previous, next) which points its previous/next available record(on same DEPT).
I want to know how I can search for the next record on same DEPT and have OFFSET added to the statement?
Thanks in advance for any help.
 
I think this question should be in PHP forum, but anyway.

The select statment has the LIMIT as follow:

[LIMIT [offset,] row_count | row_count OFFSET offset]

so you can use LIMIT $offset, 1... now, $offset should have the last record showed. If "next" is pressed, $offset++ and issue the select statment.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top