You are here: Re: [PHP] searching multiple fields « PHP « IT news, forums, messages
Re: [PHP] searching multiple fields

Posted by Brent Baisley on 07/14/05 15:53

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 bunch of other options you can use and also limitations.
Read the manual for all the details.


On Jul 14, 2005, at 4:37 AM, Ross wrote:

> 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 'name' LIKE '$search_field%'";
>
>
> but really I want it to do the folowing.
>
>
> $query = "SELECT * FROM sheet1 WHERE 'name' or 'area or
> 'organisation LIKE
> '$search_field%'";
>
> Cheers,
>
> R.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация