suttercain Posted May 6, 2007 Share Posted May 6, 2007 I everyone, I am running the following code: $total = 0; if ($total > 0); { $average = $sum/$total; echo "Sum: $sum / Total: $total"; } When I try to tun the code I get the following error: Warning: Division by zero in /home/superman/public_html/comics/comicvote.php on line 14 I understand that division by 0 is not allowed, but shouldn't the if statement prevent that division from running? Thanks. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.