For Programmers: Free Programming Magazines  


Home > Archive > PHP Programming > January 2005 > mysql search query









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author mysql search query
WindAndWaves

2005-01-27, 3:55 am

Hi Gurus

Is there a way to search for a word in any of the fields of a row using simple sql for my sql?

I have a rather complex search function on my site and right now, I dump all the text of all fields (that are text fields) in a
special field. The search function then searches this "keyword" field.

Is there a smarter way of doing this.

To recoup

I have an mysql database with about 500 records, each containing over 20 text fields (address, name, etc.... etc....). I want the
user to be able to search for a particular word (e.g. fishing or rock climbing) in all records and all fields and I would like Mysql
to return the IDs of the fields that match.

Along the lines of

SELECT ID FROM TABLE WHERE * LIKE "%test%";


skrebbel

2005-01-27, 8:55 am

"WindAndWaves" <access@ngaru.com> wrote in message
news:V20Kd.12149$mo2.932708@news.xtra.co.nz...
> Hi Gurus
>
> Is there a way to search for a word in any of the fields of a row using

simple sql for my sql?
>
> I have a rather complex search function on my site and right now, I dump

all the text of all fields (that are text fields) in a
> special field. The search function then searches this "keyword" field.
>
> Is there a smarter way of doing this.


http://dev.mysql.com/doc/mysql/en/fulltext-search.html

-skr


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com