I created a table in a database that stores the following columns.
ID - auto_increment (starts at 1 and increases)
USERID - the user's ID number
PHOTOID - the ID number for a specific photo (there can be the same PHOTOID numbers, but not for the same USERID. EXAMPLE - USERID 10023 can have PHOTO ID 1000002 and USERID 10055 can have PHOTO ID 1000002).
PHOTOURL - the URL of the photo (to display image ex. http://www.site.com/USERID#/PHOTOID#.jpg
I'm still new to MySQL and i've ordered a book on it which hasn't come in yet, but i'm hoping to at least get this part done before.
When a user uploads a photo, up to 5 at a time, I want to be able to increment the PHOTOID number (PHOTOID starts at 6 digits - 100000 per each USERID).
Also, I don't want to cause a problem with the PHOTOID's when a user deletes a photo.
Should I create a primary_key, index, unique - anything like that for my table. If so, how do I do it?
Thanks!