Re: Searching
| From: | Jeff Gannaway | Date: | Mon, 17 Jul 2000 19:17:09 +0000 |
| Subject: | Re: Searching | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-6994@lists.php.net to get a copy of this message | ||
At 11:03 AM 7/17/00 -0700, Ed Vul wrote:
>I am not quite sure how I should do this:
>I need to make a feature that would search several columns in a table for
>stuff.
>What I'm not sure is, how would I make it work like a normal searchn (using
>and, or, etc.), are there some kinds of functions in PHP for this? or do I
>have to parse the search string? I'm not quite sure where I would begin.
>On top of my php incompetence, I don't know sql very well, so that adds to
>my problem.
>Any pointers (no pun intended), in the right direction would help.
In MySQL the query stirng would look something like:
<?
$text = "blue";
$query = "SELECT * FROM table_name where (MainColor = \"$text\" ||
SecondaryColor = \"$text\" || FavoriteColor = \"$text\"";
$result = MYSQL_QUERY($query);
?>
Later,
Jeff