Re: [PHP-DB] search syntax
Great--it works now. Thanks very much, Tony. I appreciate your help. best, Matt - Original Message - From: Tony <[EMAIL PROTECTED]> To: Matthew K. Gold <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> 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 [EMAIL PROTECTED] 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"; > > > > > > > > > > > > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
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 [EMAIL PROTECTED] 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"; > > > > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] search syntax
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"; -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php