What could be the cause of this error? I already check it with if/else statement in the first level. How can it still show the “Division by zero” error?
if($sum != 0) {
$percent = (($sum / $tss) * 100);
} else {
$percent = 0;
}
Advertisement
Answer
You check $sum. You should be checking $tss.