php mysql loop links

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
amir
Forum Contributor
Posts: 287
Joined: Sat Oct 07, 2006 4:28 pm

php mysql loop links

Post by amir »

I want to show 5 images across the bottom of a page.
If you click on the next arrow, the page will refresh and show the next 5 images,
once it goes off the end, it will loop

I have a table:
ID, image, sortOrder, name

page
img1 img2 img3 img3 img4 img5
<>

click next

img2 img3 img4 img5 img1
<>

how do I do that?

I know the sql

Code: Select all

select * from item order by sortOrder
how do sort and loop the results?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

This is a pagination style issue. The query would use the LIMIT clause.
Post Reply