[thelist] php help !!

Brian Cummiskey Brian at hondaswap.com
Tue Aug 3 23:54:01 CDT 2004


info wrote:

> hi,
> i am very curious to know if someone could help me with a small 
> problem that i am having?
> i hope you can. here it is.
> visit sample site here: http://test.rowait.com/new/inventory.php
> problem: i want to search two columns from one input field. you can 
> test  it.
> search for ie. 93 honda
> and i should get all the results matching those two words (numeric as 
> well as alphanumeric).
> so far, i can only search by typing a specific field, where LIKE in 
> mysql query has been used to match against possibilities.
> thanks in advance.
> Sincerely,
> Moses

depending on how you DB is set up, one option would be to use the IN set.

select year y from table_1 AS y
left join make AS m ON y.some_id = m.some_id
where m.keyword_field IN ($IN_QUERY_STRING)
OR
y.keyword_field IN ($IN_QUERY_STRING)

or something like that

you can populate the "IN" array with a for each loop, like

foreach( $searchfield as $v )
 {
    $IN_QUERY_STRING .= "$v,";
 }
 //get rid of the last comma
   $IN_QUERY_STRING = substr($IN_QUERY_STRING,0,-1);



More information about the thelist mailing list