search syntax
| From: | Matthew K. Gold | Date: | Mon, 22 Jul 2002 04:48:53 +0000 |
| Subject: | search syntax | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-20693@lists.php.net to get a copy of this message | ||
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";