Home > Archive > PHP DB > February 2007 > Search witin text.
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Search witin text.
|
|
| Chris Carter 2007-02-11, 3:58 am |
|
Hi,
I have to send results to the users based on their search. Have got a
combined serach option in which data is searched from two different fields
and based on the match the result is sent or an error message (quite
simple). Now I need to change this, the one column of data is from a VARCHAR
field and have to seach for a perticular text from another column that is
TEXT. So there could be data like "Apparel | Footwear | Toys | Watches". If
the data matches the "Toys" the result is sent. The issue I have is quite
simple, its not working. Is there anything special that needs to be done
with the TEXT column?
Please advice, many thanks.
Chris
--
View this message in context: http://www.nabble.com/Search-witin-...0.html#a8907729
Sent from the Php - Database mailing list archive at Nabble.com.
| |
| SwivelGames 2007-02-18, 6:12 am |
| Ok, heres how I personally would do it.
Your table would be setup like this..
Item Name: Toy Car
Item Num: J89T54HT
Item Keywords: Toys | Cars | Plastic
Then what you do is something to this effect.
PHP:
...MySQL query to pull all items from DB...
for($i=0; for ($i=0; isset($row)||$i==0; $i++){
$search_results = expload(" | ", $row['item_keywords']);
If ($search == inarray($search_results)) {
....Display the result...
}
}
Just mess around with that code a bit, that should help alot. |
|
|
|
|