Posted by Jay Blanchard on 12/16/05 16:45
[snip]
can someone tell me how to do this:
i have to retrive data from a mysql table let's sayTABLE . i have to
check that the rows i retrive meet this condition:
field1='$variable',field2 is false and field3 is also false. as you
can see field2 and field3 are bool type. field1 is varchar. i did this
query "SELECT * FROM TABLE WHERE field1='$variable' AND field2='0' AND
field3='0'"; another one tried is "SELECT * FROM TABLE WHERE
field1='$variable' AND field2=false AND field3=false"; But none was a
success. it didn't matter whether i used '0' or 0 and false or
'false'.
thanks in advance.
[/snip]
That is likely because the data is either blank or NULL , try;
"SELECT * FROM TABLE WHERE field1='$variable' AND field2 IS NULL AND field3=
IS NULL ";
or
"SELECT * FROM TABLE WHERE field1='$variable' AND field2='' AND field3=''";
[Back to original message]
|