I have this script:
<?php
$result = mysql_query("SELECT * FROM high ORDER BY KC DESC LIMIT 20");
while($row = mysql_fetch_array($result))
{
echo $row['KC'];
echo "<br />";
}
?>
And this
<?php
$result = mysql_query("SELECT * FROM high ORDER BY DC DESC LIMIT 20");
while($row = mysql_fetch_array($result))
{
echo $row['DC'];
echo "<br />";
}
?>
I want to divine DC and KC and want it to show the value after dividing.
For example DC = 80 and KC = 30
The system will divine KC to DC ( 80 / 30 = 2.666666666666667 )
I tried doing this:
<?php
$result = mysql_query("SELECT * FROM high ORDER BY Runecraftlvl DESC LIMIT 20");
while($row = mysql_fetch_array($result))
{
echo $row['kills'] / $row['deaths'];
echo "<br />";
}
?>
It works just fine, but if both variables KC and DC are 0, it gives me this error:
Warning: Division by zero in /home/justxpp1/public_html/high/highscores.php on line 86
Why is that happening?