gpt4 book ai didi

php mysql 查询 | html表格

转载 作者:行者123 更新时间:2023-11-29 21:37:19 24 4
gpt4 key购买 nike

伙计们,我现在很困惑表中填充的数据没有显示第一条记录

enter image description here

html 表格:

<table class="table table-bordered table-condensed" align="center" bordercolor="#CCCCCC">
<tr bgcolor="#009933">
<td align="center" style="color:#FFF;">Name</td>
<td align="center" style="color:#FFF;">Course</td>
<td align="center" style="color:#FFF;">Grade</td>
<td align="center" style="color:#FFF;">Remark</td>
</tr>
<?php
while($result= mysql_fetch_array($query1)){
echo "<tr>";
echo "<td>".$result['stud_name']."</td>";
echo "<td class=\"text-center\">"."</td>";
echo "<td>".$result['grade']."</td>";
echo "<td>".$result['remark']."</td>";
}
?>
</table>

这是查询:

$query1 = mysql_query("SELECT * FROM tb_grade WHERE instructor_id = '$inst_id' AND term = '$term' AND description = '$desc'");

但是当我使用 json 测试查询时,它显示了所有记录

{
"test": [{
"stud_name": "Jeo De Jesus",
"grade": "58",
"remark": "Failed"
}, {
"stud_name": "Juana Gonzales",
"grade": "60",
"remark": "Failed"
}, {
"stud_name": "Wendy Lizardo",
"grade": "81",
"remark": "Passed"
}, {
"stud_name": "Jeffrey Oliveras",
"grade": "91",
"remark": "Passed"
}, {
"stud_name": "Mc Jester Salinas",
"grade": "83",
"remark": "Passed"
}],
"success": 1
}

最佳答案

我认为你没有关闭你的 .尝试一下。(未测试)

<table class="table table-bordered table-condensed" align="center" bordercolor="#CCCCCC">
<tr bgcolor="#009933">
<td align="center" style="color:#FFF;">Name</td>
<td align="center" style="color:#FFF;">Course</td>
<td align="center" style="color:#FFF;">Grade</td>
<td align="center" style="color:#FFF;">Remark</td>
</tr>
<?php
while($result= mysql_fetch_array($query1)){
echo "<tr>";
echo "<td>".$result['stud_name']."</td>";
echo "<td class=\"text-center\">"."</td>";
echo "<td>".$result['grade']."</td>";
echo "<td>".$result['remark']."</td></tr>";
}
?>

关于php mysql 查询 | html表格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34824678/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com