Get ready for BLACK FRIDAY shopping starting in

Forums

PHP

This topic is locked

Multiple WHERE not working with LIKE :: MySQL

Posted 28 Sep 2007 19:22:07
1
has voted
28 Sep 2007 19:22:07 Erik Pohovich posted:
This works just fine:

<pre id=code><font face=courier size=2 id=code>$query = "select * from my_database where field_1 like \"%$trimmed%\" order by field_3, field_4";</font id=code></pre id=code>

but nothing with multiple where fields works:

<pre id=code><font face=courier size=2 id=code>$query = "select * from my_database where field_1, field_2 like \"%$trimmed%\" order by field_3, field_4";
$query = "select * from my_database where field_1 or field_2 like \"%$trimmed%\" order by field_3, field_4";
$query = "select * from my_database where (field_1 or field_2) like \"%$trimmed%\" order by field_3, field_4";
$query = "select * from my_database where field_1 like \"%$trimmed%\", field_2 like \"%$trimmed%\" order by field_3, field_4";
$query = "select * from my_database where (field_1 like \"%$trimmed%\" or field_2 like \"%$trimmed%\" order by field_3, field_4";</font id=code></pre id=code>

and a few others I probably don't remember, will NOT work.

Any ideas?

Thanks E

Reply to this topic