Hi Niklas,

You can use || or OR.

Secondly, huge list of values you say?  Can this list be exploded by a
common denominator, like a space or comma?  If so, consider this:

$list = // Huge list of words (array), separated by a comma.
$words = explode(",", $list);
$query = "SELECT * FROM table WHERE ";

for($i = 0; $i <= sizeof($words); $i++) {
    $query .= "field LIKE '%" . $words[$i] . "%' OR ";
}

$query = substr($query, 0, -4); // need to take out:
[[:space:]]OR[[:space:]] from the end
$do_query = @mysql_query($query);


Cheers,
James

> What I need to do is to compare if one field matches a value from a huge
> list of values.
>
> Do I need to query like
> "SELECT * FROM table WHERE field LIKE '%value1%' || field LIKE '%value2%'"
> or can I do it something like this
> "SELECT * FROM table WHERE field LIKE ('%value1%' || '%value2%')"?
>
>
> Niklas Lampén
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to