MySQL Query exceptions
Posted
by Wayne
on Stack Overflow
See other posts from Stack Overflow
or by Wayne
Published on 2010-03-23T21:42:19Z
Indexed on
2010/03/23
21:43 UTC
Read the original article
Hit count: 263
In one page, it should show records that has the following selected month from the drop down menu and it is set in the ?month=March
So the query will do this
$sql = "SELECT * FROM schedule WHERE month = '" . Clean($_GET['month']) . "' AND finished='0' ORDER BY date ASC";
But it shows records that has a value of 2 in the finished column and I don't want the query to include this.
I've tried
$sql = "SELECT * FROM schedule WHERE month = '" . Clean($_GET['month']) . "' AND finished='0' OR finished = '1' OR finished = '3' ORDER BY date ASC";
But it shows records on different months when it shouldn't be.
So basically I want the record to exclude the records that has the value of 2 in the record that will not be shown in the page.
© Stack Overflow or respective owner