Hey all here i want to display my tables side by side in this form:

U_id:uid1 U_id:uid2
Name:name1 Name:name2
Team name: teamname1 Team name:teamname2
coins:coins1 coins:coins2

But some how my data gets displayed one after the other
U_id:uid1
Name:name1
Team name:teamname1
coins:coins1

U_id: uid2
Name:name2
Team name:teamname2
coins:coins2

i know that we can do this by using mod operator like
if($i%5==0)
{
echo "<table>'';

}


But despite doing this i am not getting right answer.Maybe i am assigning the mod operator at wrong place or is there any other method??????????



Code:
<?php
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
 
    $data = array_keys($_POST);

    $i = 1;

    foreach($data as $d)
    {
       $sql = "SELECT * FROM tbl_default_player_blob WHERE uid=".$d;
  
   
     $result = mysql_query($sql,$bd) or die(mysql_error());
     $data= mysql_fetch_assoc($result);
       
if($i%5==0)
   
        {
?>
         <table style="padding-bottom:178px;">
        <tbody>
        <tr>
              <th scope="row">U_Id :</th>
           <td><?php echo ($data['uid']); ?></td>
        </tr>
        <tr>
            <th scope="row">Name :</th>
            <td><?php
                /*$arr= json_encode($json);
               echo $arr;*/
                /*$json='{"name"}';*/
                $json=($data['player_json_blob']);
                $arr = json_decode($json,true);
                echo $arr["name"];
                ?>
                </td>
        </tr>
        <tr>
            <th scope="row">Teamname:</th>
              <td><?php
                $json=($data['player_json_blob']);
                $arr = json_decode($json,true);
                echo $arr["teamname"];
                ?></td>
        </tr>
        <tr>
            <th scope="row">Coins :</th>
            <td><?php  $json=($data['player_json_blob']);
                $arr = json_decode($json,true);
                echo $arr['coins'];?></td>
        </tr>
        <tr>
            <th scope="row">Cash:</th>
            <td><?php
                $json=($data['player_json_blob']);
                $arr = json_decode($json,true);
                echo $arr['cash'];
                ?></td>
        </tr>
 </table>
<?php
    }
$i++;
    }
}
?>