PHP MySQL只显示空白表
你好!我在显示表中的数据时遇到问题。我已经输入了6个数据,它将显示我的$I++中有多少个基数,但它没有显示userno、fullname和udate。我真的很感激,谢谢你!这是我的密码:PHP MySQL只显示空白表,php,mysql,mysqli,Php,Mysql,Mysqli,你好!我在显示表中的数据时遇到问题。我已经输入了6个数据,它将显示我的$I++中有多少个基数,但它没有显示userno、fullname和udate。我真的很感激,谢谢你!这是我的密码: table class="table table-striped table-sm"> <thead> <tr> <th>No</th> <th>User No</th> <th&
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>
首先,您错过了结束,其次,您真的必须使用变量i并递增它吗?在哪里可以回显所有ID?最后,你应该在变量uresult中加上echo,希望这能对你有所帮助
<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
$uquery= mysqli_query($conn, "SELECT * FROM users");
while ($uresult=mysqli_fetch_array($uquery)){
?>
<tr>
<td><?php echo $uresult ['id'];?></td>
<td><?php echo $uresult ['userno'];?></td>
<td><?php echo $uresult ['fullname'];?></td>
<td><?php echo $uresult ['udate'];?></td>
</tr>
<?php } ?>
</tbody>
</table>
and also you can write it, in this way:
and echo variable `i` if you want to see the count of it.
<?php
$uquery= "SELECT * from users";
$viewquery = mysqli_query($con,$uquery);
while($uresult = mysqli_fetch_assoc($viewquery))
{
?>
这将是您的PHP,根据您的表进行相应调整,希望这对您有所帮助 你忘记回显你的结果了 改变
<td><?php $uresult ['userno'];?></td>
<td><?php $uresult ['fullname'];?></td>
<td><?php $uresult ['udate'];?></td>
到
或
<td><?php $uresult ['userno'];?></td>
<td><?php $uresult ['fullname'];?></td>
<td><?php $uresult ['udate'];?></td>
<td><?php echo $uresult ['userno'];?></td>
<td><?php echo $uresult ['fullname'];?></td>
<td><?php echo $uresult ['udate'];?></td>
<td><?= $uresult ['userno'];?></td>
<td><?= $uresult ['fullname'];?></td>
<td><?= $uresult ['udate'];?></td>