So here is my problem, I am creating categories for my website; however, I don't want all the categories to show up under my left nav bar, just a few select ones. Is there a way I could change this code to pick certain category ids, say 30 , 31, 33, and 35 to only show up? Your help is greatly appreciated! <? // get categories $sql = mysql_query("select * from categories where id != 1"); $count = mysql_num_rows($sql); if($count > 0){ while($row = mysql_fetch_assoc($sql)){ $name = $row['name']; print ''.$name.''; } } else{ print 'There are currently 0 categories. Please login to your admin panel to manage categories.'; } ?>
Replace the first line with this: $sql = mysql_query("select * from categories where id IN(30, 31, 33, 35)") OR die(mysql_error()); PHP: