Information gets out of the table in while

0

Only the first tbody information is displayed but the others appear in lines outside the table. That's the part of my code. What could be making this happen?

 <?php
		}
  }else {
  $sqle = mysqli_query($conn, "SELECT * FROM jsondados WHERE empresa='cnet' ");
  $numRegistross = mysqli_num_rows($sqle);
	if ($numRegistross != 0) {
  ?>

<div class="tablediv">
<table class="tablestyle">
<thead>
<tr>
<th class="tabletrstyle">Info1</th>
<th class="tabletrstyle">Info2</th>
<th class="tabletrstyle">Info3</th>
<th class="tabletrstyle">Info4</th>
<th class="tabletrstyle">Info5</th>
<th class="tabletrstyle">Info6</th>
<th class="tabletrstyle">Info7</th>
<th class="tabletrstyle">Info8</th>
</tr>
</thead>


  <?php
  while ($qstr= mysqli_fetch_object($sqle)) {
  ?>


<tbody>
<tr>
<th><?=$qstr->Info1?></th>
<th><?=$qstr->Info2?></th>
<th><?=$qstr->Info3?></th>
<th><?=$qstr->Info4?></th>
<th><?=$qstr->Info5?></th>
<th><?=$qstr->Info6?></th>

</tr>
</tbody>
</table>
</div>
    
asked by anonymous 08.08.2018 / 18:28

1 answer

1

Would not that be correct?

<?php
        }
  }else {
  $sqle = mysqli_query($conn, "SELECT * FROM jsondados WHERE empresa='cnet' ");
  $numRegistross = mysqli_num_rows($sqle);
    if ($numRegistross != 0) {
  ?>

<div class="tablediv">
<table class="tablestyle">
<thead>
<tr>
<th class="tabletrstyle">Info1</th>
<th class="tabletrstyle">Info2</th>
<th class="tabletrstyle">Info3</th>
<th class="tabletrstyle">Info4</th>
<th class="tabletrstyle">Info5</th>
<th class="tabletrstyle">Info6</th>
<th class="tabletrstyle">Info7</th>
<th class="tabletrstyle">Info8</th>
</tr>
</thead>

<tbody>
<?php
  while ($qstr= mysqli_fetch_object($sqle)) {
?>
<tr>
<th><?=$qstr->Info1?></th>
<th><?=$qstr->Info2?></th>
<th><?=$qstr->Info3?></th>
<th><?=$qstr->Info4?></th>
<th><?=$qstr->Info5?></th>
<th><?=$qstr->Info6?></th>
</tr>
<?php 
  } 
?>
</tbody>
</table>
</div>
    
08.08.2018 / 18:31