using Mysql and PHP to store and search for keywords of a record
| From: | Eager Ip | Date: | Thu, 29 Jun 2000 19:40:00 +0000 |
| Subject: | using Mysql and PHP to store and search for keywords of a record | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-758@lists.php.net to get a copy of this message | ||
Hi,
I am developing a database driven website that allows user to search the
title and ID of a record by keywords. I want to set up a field called
"keyword" in the database table to store all the keywords associated with
the records, e.g.
record ID record title keywords
1 a title keyword1, keyword2,
keyword3, keyword4, etc.
and I want to use both Mysql query and PHP to find any matches in the
keywords field and return the record ID and title.
What is the best data/column type in Mysql for me to store and query the
keywords? What kind of method should I use to separate different keywords
(e.g. use commas "," or tab "/t")? And what is the best/efficient way to
search for those keywords using PHP? (I am thinking about the string compare
functions and array explode functions, but I am worrying about the speed of
the search because we will have more than 100 records in the table and there
will be at least 5 keywords for each record.)
Thanks for your help.
Eager =:o3
ipeager@interchange.ubc.ca