PHP while代码错误
使用函数代替mysqli\u fetch使用mysqli\u fetch\u数组代替mysqli\u fetchPHP while代码错误,php,error-handling,while-loop,Php,Error Handling,While Loop,使用函数代替mysqli\u fetch使用mysqli\u fetch\u数组代替mysqli\u fetch 此外,如果要在不使用索引的情况下获取,请使用mysqli\u fetch\u assoc(),表位于循环中 或 如果要使用索引获取,请使用mysqli\u fetch\u array() 我认为您在这里做错了,因为您的表标记在中,而循环和也在循环中。 我认为它应该在while循环之外。查询中有语法错误,还有一个额外的 你的完整代码 <?php $host="localhost
此外,如果要在不使用索引的情况下获取,请使用mysqli\u fetch\u assoc(),表位于循环中 或 如果要使用索引获取,请使用
mysqli\u fetch\u array()
我认为您在这里做错了,因为您的表标记在中,而循环和
也在循环中。
我认为它应该在while循环之外。查询中有语法错误,还有一个额外的
你的完整代码
<?php
$host="localhost";
$user="root";
$pwd="";
$db="assigment";
$conn=mysqli_connect($host,$user,$pwd,$db);
$query="SELECT * FROM 'tdata'";
$result=mysqli_query($conn,$query);
while ($row=mysqli_fetch($result)) {
?>
<table class="table">
<thead>
<tr>
<th>Full Name</th>
<th>Email</th>
<th>Birthday</th>
<th>Gender</th>
<th>Intrests</th>
<th>Address</th>
<th></th>
</thead>
</tr>
<tbody>
<?php echo "<tr><td>".$row[full_name]."</td></tr>";
}
?>
</tbody>
</table>
全名
电子邮件
生日
性别
兴趣
地址
<?php
$host="localhost";
$user="root";
$pwd="";
$db="assigment";
$conn=mysqli_connect($host,$user,$pwd,$db);
$query="SELECT * FROM tdata ";
$result=mysqli_query($conn,$query); ?>
<table class="table">
<thead>
<tr>
<th>Full Name</th>
<th>Email</th>
<th>Birthday</th>
<th>Gender</th>
<th>Intrests</th>
<th>Address</th>
</tr>
</thead>
<tbody>
<?php while ($row=mysqli_fetch_assoc($result)) { ?>
<tr>
<td><?php echo $row['full_name']; ?></td>
<td><?php echo $row['your table field name']; ?></td>
<td><?php echo $row['your table field name']; ?></td>
<td><?php echo $row['your table field name']; ?></td>
<td><?php echo $row['your table field name']; ?></td>
<td><?php echo $row['your table field name']; ?></td>
</tr>
<?php }
?>
</tbody>
</table>