Populate HTML Bootstrap table with MySQL data using PHP [closed]

I downloaded a Bootstrap template for admin panel. I want to fill a table with data from a MySQL database. I created a Stored Procedure in the database that basically makes a SELECT * FROM CLIENTS, and to test it out I made the following php file:

$conn = mysqli_connect("localhost", "user", "password", "db", "port");

$result = mysqli_query($conn, "call myStoredProcedure")
  or die("Query fail: " . mysqli_error());

while ($row = mysqli_fetch_array($result)) {
  echo $row[0] . ' - ' . $row[1] . ' - ' . $row[2] . "<br>";

And it returns just what I want, a list of clients with some info separated by ‘-‘. It’s saved as an individual PHP file and run from my browser.

Ok, so I need that data in a table. I use this to create the table:

<table class="table table-striped table-bordered table-hover" id="dataTables-example">
      $conn = mysqli_connect('localhost', 'user', 'password', 'db', 'port');
      $result = mysqli_query($conn, 'call myStoredProcedure') or die('Query fail: ' . mysqli_error());
      <?php while ($row = mysqli_fetch_array($result)) { ?>
            <td><?php echo $row[0]; ?></td>
            <td><?php echo $row[1]; ?></td>
            <td><?php echo $row[2]; ?></td>
            <td><?php echo $row[3]; ?></td>
            <td><?php echo $row[4]; ?></td>
      <?php } ?>

So as you can see, I use the exact same code that I use on the PHP file, but nothing is changing on the table, it says it has 1 record but it’s empty.


I tried solutions found on other questions but nothing worked for me. Any ideas on what could be wrong?

Note: Both the individual php file and the html are on the same folder in the server, so I believe that both are making a successful connection and therefore, retrieving the data.

Thanks a lot!

EDIT: Here’s the stored procedure I call from the PHP:



try with this way for echo

  <?php while ($row = mysqli_fetch_array($result)) { 
    echo "<tr>
        <td>" . $row[0] . "</td>
        <td>" . $row[1] . "</td>
        <td>" . $row[2] . "</td>
        <td>" . $row[3] . "</td>
        <td>" . $row[4] . "</td>