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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dB design for multiple images

Status
Not open for further replies.

GUJUm0deL

Programmer
Jan 16, 2001
3,676
US
I have a form where the user can upload multiple images. The user can upload 5, 10, 15, 30, 50 images -- however many as s/he wants.

I am having some difficulties in getting the dB schema setup.

My original design idea was: photoID, catid, picname, picurl

But then I realized how will it work if the user uploads 10 images under on catid, 2 images in another catid, and 35 images under a third catid?

_____________________________
Just Imagine.
 
on the flash I could think of adding new field of uid.. which can enable to have multiple categories for a single user and each category can have as many as details that user uploads..




Regards,


"Dream not what makes your sleep a pleasure, but what makes you work
hard to achieve it and forget your sleep (untill you achieve it)." -- SJD
 
I thought about it some, and how does this sound:
table: Photo
photoID, catid

table: Pictures
picid, picname

table: photo_pictures
ppid, picid, photoid

So, when the user uploads an image, I update three tables. Then to retrieve all images, I can join Photo and pictures by photo_pictures.

Does that sound like a good idea?

_____________________________
Just Imagine.
 
are you saying that one picture can have multiple categories and one category can belong ton multiple pictures?

If so then that's a standard many to many relationship and your solution is the generally accepted one.

If one picture can only have one category, then I fail to see the problem...

--------------------
Procrastinate Now!
 
No, many pictures can only have one category and subcategory. Sorry, I forgot that in my original post.

My original design idea was:
photoID, catid, subcatid, photogroup, picname

I think I see your point. I wasn't sure how to retrive all pics that belong to a particular catid/subcatid and have them grouped based on the photogroup name.

Do you think the above schema would be OK?


_____________________________
Just Imagine.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top