Re: explode () and mySQL query
| From: | Chris | Date: | Thu, 29 May 2008 01:37:09 +0000 |
| Subject: | Re: explode () and mySQL query | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-45010@lists.php.net to get a copy of this message | ||
Ron Piggott wrote:
> I am not sure why this isn't bringing any results:
>
> WHERE shopping_cart_product.product_description IN ('straying')
>
> The word straying is in the midst of one of the descriptions.
Ahh, oops - didn't notice that before.
"IN()" looks for specific entries, so unless the entry is "straying" and
*only* "straying" it will not be found.
You can either use full text indexes
(http://dev.mysql.com/doc/refman/5.0/en/fulltext-search.html) or "like"
searches:
where description like '%straying%' or description like '%another word%';
full-text works best on a big, random database (if you have a lot of
keywords that are the same it won't work very well).
--
Postgresql & php tutorials
http://www.designmagick.com/