有没有人看到这个错误?我没有打印出第二个循环所期望的结果。第二个循环标题如何打印没有问题。
我正在尝试从 SQL 数据库打印数据。
<?php
$con= new mysqli('localhost','root','','regional_data');
if (mysqli_connect_errno()) {exit('Connection failed: '. mysqli_connect_error());}
$result = mysqli_query($con,"SELECT * FROM newchk WHERE dist_chk='$distUsr'");
echo "<table cellpadding='2' class='tablet' cellspacing='0'>";
echo
"<tr>
<th></th>"
."<th>"."Starting Cheque No"."</th>"
."<th>"."Ending Cheque No"."</th>"
."<th>"."Total No of Cheques remaining"."</th>"
."<th>"."Cheque Type"."</th>"
."</tr>";
while ($reca = mysqli_fetch_array($result))
{
echo "<tr>";
echo "<td><input type='checkbox' ></td>";
echo "<td>".trim($reca["sbstart"])."</td>";
echo "<td>".trim($reca["sbend"])."</td>";
echo "<td>".trim($reca["totsb"])."</td>";
echo "<td>SB</td>";
echo "</tr>";
}
echo "</table>";
echo "<table cellpadding='2' class='tablet' cellspacing='0'>";
echo
"<tr>
<th></th>"
."<th>"."Starting Cheque No"."</th>"
."<th>"."Ending Cheque No"."</th>"
."<th>"."Total No of Cheques remaining"."</th>"
."<th>"."Cheque Type"."</th>"
."</tr>";
while ($reca = mysqli_fetch_array($result))
{
echo "<tr>";
echo "<td><input type='checkbox' ></td>";
echo "<td>".trim($reca["gwstart"])."</td>";
echo "<td>".trim($reca["gwend"])."</td>";
echo "<td>".trim($reca["totgw"])."</td>";
echo "<td>GW</td>";
echo "</tr>";
}
echo "</table>";
$con->close();
?>
</div>