Reputation: 13
I have a question, I would like to make a query in mysqli.
I want to do this
$sql = $db->query("SELECT * FROM padges WHERE enable ='1' AND enable='0'");
But it is not working. How do I solve this ?
Upvotes: 1
Views: 39
Reputation: 157828
An enable ='1' AND enable='0'
condition won't return any rows. Because database does search not the way you think it is. It will pick rows one by one, and test each against this condition. And obviously find no rows, as there couldn't be a row that's enabled and disabled at the same time. Instead you have to find rows that are either enabled or disabled:
SELECT * FROM padges WHERE enable ='1' OR enable='0'
Or, if 0 and 1 are the only values, you can omit WHERE clause at all
SELECT * FROM padges
Upvotes: 1