Re: search syntax
| From: | Tony | Date: | Mon, 22 Jul 2002 05:01:25 +0000 |
| Subject: | Re: search syntax | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-20694@lists.php.net to get a copy of this message | ||
Try break up the query, like:
WHERE (column1 LIKE '%$search%' OR column2 LIKE '%$search%' OR column3 LIKE
'%$search%') AND ...
Tony S. Wu
Matthew K. Gold at mgold1@gc.cuny.edu wrote:
> hi everyone,
>
> I'm writing the code to make my mysql database searchable. I can search two
> columns, but I seem to have problems when I try to search three.
>
> In the SELECT statement, this WHERE statement works: WHERE column1 OR
> column2 LIKE '%$search%' AND...
>
> This WHERE statement doesn't work: WHERE column1 OR column2 OR column3 LIKE
> '%$search%' AND ...
>
> I'm obviously having a syntax problem...Thanks in advance for your help.
> And in case any of this is confusing, I'll include the real code below.
>
> Thanks,
>
> Matt
>
>
> $get_data = "select course.CourseNumber, course.CourseTitle,
> concat(prof.ProfFName, \" \", prof.ProfLName), instit.InstitName,
> disc.DiscName, course.Format from course, disc, instit, prof where
> course.CourseTitle or course.CourseDesc or disc.DiscName like '%$search%'
> and course.DiscID = disc.DiscID and course.InstitID = instit.InstitID and
> course.ProfID = prof.ProfID order by $orderby";
>
>
>
>
>