faqts : Computers : Programming : Languages : PHP : Database Backed Sites : MySQL

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

3 of 21 people (14%) answered Yes
Recently 2 of 10 people (20%) answered Yes

Entry

How would I create the syntext for a query like; select foobar like '%brown,charly%' ..If someone searchs "charly brown" how can I find it?

Jul 28th, 2002 13:04
Scott Lawson, Henrik Hansen, Patrick Hanf,


mytable = the name of the table you wish to serach
myfield = the name of the field you wish to search
$mysearch = this is a vqariable containing the search string. eg.
$mysearch = "charlie brown";
SELECT * FROM mytable WHERE myfield REGEXP\"($mysearch)\"='1'