The best thing for you to do is use the WHERE Clause for your statement. For instance
$query="SELECT * FROM content WHERE section='section1' AND category='category1'";
But if you really want to use a if statement to exclude info you would just follow something like this.
if($section =...