Posted by Kimmo Laine on 09/26/06 09:36
"Jeff Gardner" <null@spamvoid.tld> wrote in message
news:_ZRRg.5286$e66.3828@newssvr13.news.prodigy.com...
> Greetings:
>
> I am attempting to split an input string using the str_word_count function
> to return multiple single word query variables.
> I can create an array based on
> $search=(str_word_count($search, 1, '0123456789')); (I want words and/or
> numbers).
Stop right here and go no further with the extract thingy. Here you already
have a nice beautiful array, arrays are the coolest, aren't they!? Why go
thru all the trouble with exteracting and such...
You can build up the query conditions with a little implode trick:
$query_conditions =
" my_field LIKE '%" . implode( "%' OR my_field LIKE '%", $search) . "%'";
now insert $query_condition in your query string:
> $q="
> SELECT *
> FROM *
> WHERE table1.row1
> LIKE '%$search_x%'
> OR LIKE '%$search_y%'
> etc..."
HTH
--
"Ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" - lpk
http://outolempi.net/ahdistus/ - Satunnaisesti pδivittyvδ nettisarjis
spam@outolempi.net || Gedoon-S @ IRCnet || rot13(xvzzb@bhgbyrzcv.arg)
[Back to original message]
|