Massive Image Organizer

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

User avatar
allspiritseve
DevNet Resident
Posts: 1174
Joined: Thu Mar 06, 2008 8:23 am
Location: Ann Arbor, MI (USA)

Re: Massive Image Organizer

Post by allspiritseve »

Skara wrote:Ok, what do you mean by an association table between them? As in..

image: id, info, info, info
tag: id, name
assoc: imageid, tagid

?? Why not just have the two tables?
Yeah, that's what I meant. You have to link them somehow. In an earlier example, you had tag1, tag2, tag3 in your images table. This works, but only allows you 3 tags per image. With an association table, one image can have unlimited tags and one tag can be attached to unlimited images.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Massive Image Organizer

Post by Christopher »

Why not just:

image: id, info, info, info
tag: image_id, name

Search for tag names JOINed on the image table and return DISTINCT image info.
(#10850)
User avatar
Skara
Forum Regular
Posts: 703
Joined: Sat Mar 12, 2005 7:13 pm
Location: US

Re: Massive Image Organizer

Post by Skara »

arborint wrote:Why not just:

image: id, info, info, info
tag: image_id, name

Search for tag names JOINed on the image table and return DISTINCT image info.
Yeah, that was my question. I think this is a better solution.
Also, when I said "tag1, tag2, tag3", I meant that to be a single TEXT block rather than three separate VARCHAR entities. The point being to fulltext search the column. But yeah, a separate table is a better solution. I just don't see the need to have a third association table.
Post Reply