Re: search syntax
| From: | Matthew K. Gold | Date: | Mon, 22 Jul 2002 05:21:06 +0000 |
| Subject: | Re: search syntax | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-20695@lists.php.net to get a copy of this message | ||
Great--it works now. Thanks very much, Tony. I appreciate your help.
best,
Matt
----- Original Message -----
From: Tony <e_lists@mac.com>
To: Matthew K. Gold <mgold1@gc.cuny.edu>; <php-db@lists.php.net>
Sent: Monday, July 22, 2002 1:01 AM
Subject: Re: [PHP-DB] search syntax
> 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";
> >
> >
> >
> >
> >
>
>
>