SQL AND and OR operators
Unsolved
Independent Developers
-
Simply put, I want to know if you can utilize both of them in a PHP code. I had the following idea:
$sql2 = mysql_query("SELECT * FROM forum WHERE id='$topicsnumber' AND main='0' OR main='1' OR main='2'"); while($row=mysql_fetch_array($sql2)) {code in here}
Where id='$topicsnumber' AND (main='0' OR main='1' OR main='2') is the condition under which it is checked. Can this be done? I have referred to this article