Information is off the table in while

Asked

Viewed 23 times

0

Only the first information from tbody is shown the others appear however in lines outside the table. What may be making this happen?

follows below the code snippet:

 <?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>

  • Where is the end of the while ?

1 answer

1

Right wouldn’t be like this?

<?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>
  • Oops, silly mistake, I was leaving to close after the </table>, thank you. My inattention.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.