Populating page using mysql db, and next and previous button
Posted: Thu Mar 09, 2006 2:56 pm
Hey guys,
This is a little hard to explain so bare with me. If you go to http://www.phoenixmason.com/newsite/gal.php you can get a better idea of what I am trying to do.
First off my db table is orginized in this way:
ImgKey (auto increments)
ImgType (pertaining to the buttons in the gallery)
ImgName (name of image)
When you click a button from the initial gallery page, my plan is to pass a query string to the next page with the appropriate ImgType. On the next page I need to grab all the records in the table with that ImgType. (you can see the next page by clicking the first button)
Thats the easy part. I am a little stuck on what to do about displaying the images with the "next" and "previous" buttons while only using one page.
On the initial load of the second page I want to display the first Image of that ImgType and check to see if there is another record in the table with the same ImgType. If there is I then want to show the "next" button and once you click it display the next image. And so on and so forth.
I would like not to have to reload the buttons everytime you hit the "next" and "previous" buttons, so I'm thinking I will have to use either javascript or frames.
Any suggestions on how I can go about doing this efficiently would be very helpful. Also if you could tell me the sql function on how to check to see if there is a next and previous record in a table, that would be helpful too.
Thanks a million
Matt
This is a little hard to explain so bare with me. If you go to http://www.phoenixmason.com/newsite/gal.php you can get a better idea of what I am trying to do.
First off my db table is orginized in this way:
ImgKey (auto increments)
ImgType (pertaining to the buttons in the gallery)
ImgName (name of image)
When you click a button from the initial gallery page, my plan is to pass a query string to the next page with the appropriate ImgType. On the next page I need to grab all the records in the table with that ImgType. (you can see the next page by clicking the first button)
Thats the easy part. I am a little stuck on what to do about displaying the images with the "next" and "previous" buttons while only using one page.
On the initial load of the second page I want to display the first Image of that ImgType and check to see if there is another record in the table with the same ImgType. If there is I then want to show the "next" button and once you click it display the next image. And so on and so forth.
I would like not to have to reload the buttons everytime you hit the "next" and "previous" buttons, so I'm thinking I will have to use either javascript or frames.
Any suggestions on how I can go about doing this efficiently would be very helpful. Also if you could tell me the sql function on how to check to see if there is a next and previous record in a table, that would be helpful too.
Thanks a million
Matt