[thelist] php help !!

Anthony Baratta Anthony at Baratta.com
Tue Aug 3 23:59:49 CDT 2004


info wrote:
> problem: i want to search two columns from one input field.

First split/explode on space, comma or some other delimiter. Create an 
array for all the columns you want to test. Then loop through the list 
building your SQL where clause so you end up with something like this:

	where
	col1 like 'option1' OR
	col2 like 'option1' OR
	col1 like 'option2' OR
	col2 like 'option2'

Hope that helps.


--
Anthony Baratta

The most exciting phrase to hear in science,
the one that heralds new discoveries, is not
"Eureka!" (I found it!) but "That's funny ..."
   -- Isaac Asimov


More information about the thelist mailing list