Best way to search for....?

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
iain
Forum Newbie
Posts: 4
Joined: Fri Aug 18, 2006 12:53 pm

Best way to search for....?

Post 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,
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post 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)
iain
Forum Newbie
Posts: 4
Joined: Fri Aug 18, 2006 12:53 pm

Post 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.
User avatar
hawleyjr
BeerMod
Posts: 2170
Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA

Post 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
Post Reply