0

below I put the code with a real error through an image, I was wondering if it was a problem because I have the site locally and not on a server using another type of system. Although this error is not the first I see it with a 0 division

the error comes from: $rank_killdeath $rank_winrate

enter image description here

 <tbody>  

    <?php
              $strRank = "SELECT * FROM accounts order by exp desc limit 20";
              $num = 1;
              foreach ($connec->query($strRank) as $row) 
              {
                $rank_killdeath   =     round($row['kills_count'] / ($row['kills_count']+$row['deaths_count']) * 100)."%";
                $rank_winrate   =   round($row['fights_win'] / ($row['fights_win']+$row['fights_lost']) * 100)."%";
                ?>               
                         
      <tr>
        <?php if($num <= 3){ ?>
        <td><img src="dist/images/rank<?php echo $num;?>.png"></td>
        <?php }else{ ?>
        <td><?php echo $num;?></td>
        <?php } ?>
        <td><img src="dist/images/rank/<?php echo pg_escape_string($row['rank']); ?>.gif"> <?php if($row['player_name']==""){echo "The character hasn't been created yet.";}else{echo $row['player_name'];} ?></td>  
        <td><?php echo number_format($row['exp']); ?></td>  
        <td><?php echo $rank_winrate; ?></td>  
        <td><?php echo number_format($row['kills_count']); ?></td>
        <td><?php echo number_format($row['deaths_count']); ?></td> 
        <td><?php echo $rank_killdeath; ?></td>  
        <td><?php echo number_format($row['headshots_count']); ?></td> 
        <td>
          <?php if($row['online'] == true){ ?>
            <span class="badge badge-pill badge-success" style="background-color: green;">Online</span>
        <?php }else { ?>
            <span class="badge badge-pill badge-success" style="background-color: red;">Offline</span>
        </td>     
      </tr>         
      <?php
  }
            $num++;
          }
            ?>
    </tbody>  

0 Answers0