Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
138 views
in Technique[技术] by (71.8m points)

PHP MySQL only displays Blank Table

Good Day! Im having a problem displaying the data from table. I have already inputted 6 data and it will show how many base from my $i++ but it does not show the userno, fullname and udate. i would really appreciate it Please and thank you! Table Display Here is my code:

table class="table table-striped table-sm">
  <thead>
    <tr>
      <th>No</th>
      <th>User No</th>
      <th>User Name</th>
      <th>Date Registered</th>
    </tr>
  </thead>
  <tbody>

    <?php
      $i=0;
      $uquery= mysqli_query($conn, "SELECT * FROM users");
      while ($uresult=mysqli_fetch_array($uquery)){

      $i++;  
    ?>
      <tr>
        <td><?php echo $i;?></td>
        <td><?php $uresult ['userno'];?></td>
        <td><?php $uresult ['fullname'];?></td>
        <td><?php $uresult ['udate'];?></td>

    <?php }; ?> 
  </tbody>
</table>
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You forgot to echo your results.

Change

<td><?php $uresult ['userno'];?></td>
<td><?php $uresult ['fullname'];?></td>
<td><?php $uresult ['udate'];?></td>

To

<td><?php echo $uresult ['userno'];?></td>
<td><?php echo $uresult ['fullname'];?></td>
<td><?php echo $uresult ['udate'];?></td>

Or

<td><?= $uresult ['userno'];?></td>
<td><?= $uresult ['fullname'];?></td>
<td><?= $uresult ['udate'];?></td>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...