php - Misplacement of info in rows in tables in Boostrap -


i have responsive bootstrap table , of info generate php doesn't sit correctly in row. here link screenshot:

screenshot

the php code, generates table this:

if ($result->num_rows > 0) {     // output data of each row     while($row = $result->fetch_assoc()) {         echo "<div class='table-responsive'>";         echo "<table class='table'>";         echo "<tr>";         echo "<td>" . $row["id"] . "</td> " . "<td>" . $row["firstname"] . "</td> " . "<td>". $row["lastname"] ."</td>";         echo "</tr>";         echo "</table>";         echo "</div>";     } } else{ echo "0 results"; } 

you using while loop above div generating div , table again , agian.

insted of place loop after table tag , before <tr>. generate new row insted of div , table.

your code should similar this:

<?php if ($result->num_rows > 0) {    // output data of each row ?>  <div class='table-responsive'>         <table class='table'>             <?php                 while($row = $result->fetch_assoc()) {                     echo "<tr>";                     echo "<td>" . $row["id"] . "</td> " . "<td>" . $row["firstname"] . "</td> " . "<td>". $row["lastname"] ."</td>";                     echo "</tr>";                 }               ?>         </table>     </div>   <?php } else{ echo "0 results"; } ?> 

Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -