Page 1 of 1

Best way to search for....?

Posted: Mon Sep 25, 2006 9:50 am
by iain
Not sure how well I'm going to explain this - but here goes.

At the moment I have a table for 'Photos' and a table for 'Keywords' and a linking table PhotoKeywords.

It's a many to many relationship in that any photo can have many keywords, and any keyword can be associated with many photos.

The keywords are currently 'attached' to any given photo using numbered checkboxes.

What I want to be able to do now is search for photos based on the keywords associated with each.

If that makes sense, what is the best way to search for these records?

I had wondered if I might need to create a 'keywords' field that is populated with any attached keywords, and simply search in that field?

Hope that makes sense, and someone can point me in the right direction.

Cheers,

Posted: Mon Sep 25, 2006 10:47 am
by Luke
I'm assuming this is mysql? you need to read up on table joins... why is this in PHP code? Isn't this an SQL question? (database)

Posted: Mon Sep 25, 2006 11:56 am
by iain
The Ninja Space Goat wrote:I'm assuming this is mysql? you need to read up on table joins... why is this in PHP code? Isn't this an SQL question? (database)
Sorry, yes - wrong forum.

If a mod could move it that would be great.

Cheers.

Posted: Mon Sep 25, 2006 1:58 pm
by hawleyjr
iain wrote:
The Ninja Space Goat wrote:I'm assuming this is mysql? you need to read up on table joins... why is this in PHP code? Isn't this an SQL question? (database)
Sorry, yes - wrong forum.

If a mod could move it that would be great.

Cheers.

Moved to Databases

Image