: Friday, July 15, 2005 1:51 AM
To: php-general@lists.php.net
Subject: Re: [PHP] searching multiple fields
Brent Baisley wrote:
Sounds like you want to use full text indexing. Create one full text
index spanning name, area, organisation. Then search on all three
fields at once.
SELECT * FROM
Is there a way to use like to search various fields at one time.
For example I want the search field to search by name or area or
organisation. If the (minimum)three letter string matches any of these I
want the record to show. $search_field is my textbox
$query = SELECT * FROM sheet1 WHERE
Hello Ross,
Thursday, July 14, 2005, 9:37:10 AM, you wrote:
R $query = SELECT * FROM sheet1 WHERE 'name' or 'area or 'organisation LIKE
R '$search_field%';
SELECT * FROM blah WHERE name LIKE '$search%' OR area LIKE '$search%'
OR blahblah LIKE '$search%'
etc
If you want to add extra conditions
...I want it to do the folowing.
$query = SELECT * FROM sheet1 WHERE 'name' or 'area or 'organisation LIKE
'$search_field%';
SELECT * FROM sheet1 WHERE 'name' LIKE '$search_field%'
OR 'organization' LIKE '$search_field%'
lk
Sounds like you want to use full text indexing. Create one full text
index spanning name, area, organisation. Then search on all three
fields at once.
SELECT * FROM sheet1 MATCH(name,area,organisation) AGAINST
('textstring* otherstring* etc*). The * means use LIKE searching.
There are a
Brent Baisley wrote:
Sounds like you want to use full text indexing. Create one full text
index spanning name, area, organisation. Then search on all three
fields at once.
SELECT * FROM sheet1 MATCH(name,area,organisation) AGAINST ('textstring*
otherstring* etc*). The * means use LIKE
6 matches
Mail list logo