After a query in MySQL, in order to avoid the Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given error, I've done the following check:
if($result != null){
    while($row = mysql_fetch_assoc($result)){
         //Do awesome things        
    }
}
I don't want to do anything if the result is empty, so the if() is not required. I'm sure that it's possible to do that check in a better way. Any idea?
 
     
    