So I've been trying to get a damn search option to work with one of my mainstream projects for the past day or so but it's just not working. Here's the query I'm using:
Quote:
$trysrch = @mysql_query("select * from table_name where item_name like '$srch' || item_name2 like '$srch' || item_name3 like '$srch' && area = '$place' order by item_name asc");
|
Looks fine right? According to documentation this should work. Well, all of the selects for the OR (||) work, but once it gets to the AND part it seems to just overlook it and doesn't do anything. It does finish successfully (as in no errors) but it doesn't use the AND part (doesn't further narrow the results by executing the actual logic).
My questions: Why doesn't this work? What am I doing wrong if it's wrong?
This has been frustrating the shit out of me.
Thanks to all who will be kind enough to reply.