Q:

PHP : Alternate Table Column if counter is odd

I am generating something close to a contact list. I want my contacts to be listed next to each other depending on their position.
Example:
Contacts
pos 0 | Pos 1
pos 2 | pos 3
I have manage to get the results into table but for some reason they are loading this way Screenshot, with test1 being item at position 0, I want Test Test to be in the left column and Test2 Test2 to be in the right column. 
My Code: 
<?php
$connection = connectToSql();
$query = "SELECT * FROM visitorsystem.employee";
$result = mysqli_query($connection,$query)
          or die("Error in query: ". mysqli_error($connection));
?>
<form action="#" method="POST"> 
    <table class="table" style = "margin-top:50px">
        <?php 
        $i=0;
        while ($row = mysqli_fetch_assoc($result)){ 
            echo "$i";
            if($i % 2 == 0  &&  $row != count($result)){ 
                ?>
                <tr>
                    <td>
                        <button type="button" class="btn btn-link"  style="width:100%;">
                            <h4> <?php echo "$row[name]". " " . "$row[surname]";?> </h4>
                        </button>
                    </td>
                    <?php
            }else
                ?> 
                <td>
                    <button type="button" class="btn btn-link"  style="width:100%;">
                        <h4> <?php echo "$row[name]". " " . "$row[surname]";?> </h4>
                    </button>
                </td>
            </tr>
            <?php
            $i++;
        }
        ?>

A:

echo '<tr>';
while ($row = mysqli_fetch_assoc($result)){ 
    ?>
    <td>
        <button type="button" class="btn btn-link"  style="width:100%;">
            <h4> <?php echo "$row[name]". " " . "$row[surname]";?> </h4>
        </button>
    </td>
    <?php
    $i++;
    if($i % 2 == 0){
        echo '</tr><tr>';
    }
}
echo '</tr>';

Always echo the same <td>, and change row every 2 entries. 

