im trying to do a calculation of variables but my answer is coming out with an error (Warning: Division by zero in), i assume its because by default my variables are actually Zero.
<?php
$tax = $row['tax']; //Pulls Tax Data
$totalPayableSites = $row3['total']; // pulls total sites payable
$iskPerRun1 = $sum_total - $tax;
$iskPerRun2 = $iskPerRun1/$totalPayableSites;
$iskPerRunRound = floor($iskPerRun2 / 100) * 100;
$iskPerRun = number_format($iskPerRunRound);
if (($iskPerRunRound) == 0) {
echo "0 ISK"; }
else {
echo $iskPerRun;
echo " ISK"; }
?>
how can i re-write this to check if its zero and only run calculations if its not zero?
apart from that the code works flawless when my variables are not "0"
All variables are "0" by default before the script is edited.
if
statement ? – Clément Prévost