Hi all,
First post to this forum. Learning PHP/mySQL
I am writing a db driven image gallery.
My table structure is as follows
TABLE 1:
Name: gallery_category
Field 1: gallery_id (PRI KEY auto-inc NOT NULL)
Field 2: gallery_name (VARCHAR)
Table 2:
Name: gallery_photos
Field 1: photo_id (PRI KEY auto-inc NOT NULL)
Field 2: photo_filename (VARCHAR)
Field 3: photo_caption (VARCHAR)
Field 4: category_id (INT)
OK, so I can successfully query the database and pull out a pic based on variables sent with the link $cid and $pid
My problems are:
I don't have a way of automatically selecting the "first" image in a category (I want them to be displayed in a particular order) since photo with photo_id = 5 may actually be the first record in the database for a particular category.
Should I add a photo_order column?
I want to find a way of putting a 'smart' next and previous link on the page. Smart as in it knows when it gets to the last and or first pic of a category. I know this will involve a count of rows returned from a query based on category, but can't figure the best steps to take after that...
Any help greatly appreciated...
jreid