04-23-2014, 08:44 PM
|
|
see you later, I'm gone
Industry Role:
Join Date: Oct 2002
Posts: 14,057
|
Quote:
Originally Posted by Nookster
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:
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.
|
Quote:
Originally Posted by tical
put the OR parts in parenthesis, i think that should fix it
$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");
|
Quote:
Originally Posted by Nookster
Thank you very much. It works great now.  Guess I should read more. 
|
8chars..
__________________
All cookies cleared!
|
|
|