Page 1 of 1

Why doesnt this work?

Posted: Wed Sep 08, 2010 1:09 pm
by dominod
Hi !

I am trying this code:

Code: Select all

 $query = "SELECT * FROM `table` WHERE name LIKE '%$keyword%' AND blocked != '%no%' ORDER BY hits DESC LIMIT 10 ";
The 'blocked' row has the following value: "se dk no uk es"

Now, what I want it to do is to NOT include that row IF it finds "no" in the blocked row... The problem is that it dont block it :/ It works if I dont use wildcard characters and the 'blocked' row = 'no' but I want to have multiple values in that row...


Thanks in advance :)

Re: Why doesnt this work?

Posted: Wed Sep 08, 2010 1:16 pm
by AbraCadaver
% is used as a wildcard in LIKE expressions:

[text]AND blocked NOT LIKE '%no%'[/text]

Re: Why doesnt this work?

Posted: Wed Sep 08, 2010 4:18 pm
by dominod
Thanks alot! U made my day :D