PDA

View Full Version : Advice about adding a search box to gallery.


tux
10-08-2008, 08:38 PM
Okay, I'm thinking ahead here but my next project will be another photography based website. This time I want to build in a search facility so users can enter keywords to search the gallery.

I am thinking that maybe I should include a keyword field in the database and populate it with keywords for each image. Then use the keywords to query the DB using a condition. What should I be thinking about to create this kind of search facility.

I was also thinking of somehow capturing keywords entered by users so I could use them in future. For example, if a keyword was not found it could be saved and added later.

Any thoughts and advice on this would be great. No hurry though as project not starting for a few more weeks.

Thanks all.

davidj
10-08-2008, 09:40 PM
in your image table you would have an id

you could create a key word table with a relationship in the id

you could use a row for each keyword and have [many] id's which link to your gallery or you could have a single field in your keyword table for each gallery link. This could hold your keywords as a single string but delimited by a pipe (or something) which you could use to search on

strstr() function for example

or better use...

strpos()

tux
10-09-2008, 05:54 AM
Thanks Dj I'll give that some thought.

Any other ideas anyone.

davidj
10-09-2008, 06:00 AM
come back when your ready and we will knock up a demo

tux
10-09-2008, 06:03 AM
Thanks David.