它忽略了第一行表格。我做错了什么?
$sql = "SELECT * FROM combo1 group by id ";
$result = mysqli_query($link, $sql);
if ($result && mysqli_num_rows($result) > 0) {
while($row = $result->fetch_assoc()) {
echo "<center>";
while($row = mysqli_fetch_array($result)){
echo "<tr>";
echo "<td>" . $row['column'] . "</td>";
echo "<td>" . $row['type'] . "</td>";
echo "<td>" . $row['value'] . "</td>";
}
}
}
答案 0 :(得分:0)
你有两个循环
while($row = mysqli_fetch_array($result)){
只使用一个
编辑:
$sql = "SELECT * FROM combo1 group by id ";
$result = mysqli_query($link, $sql);
if ($result && mysqli_num_rows($result) > 0) {
while($row = $result->fetch_assoc()) {
echo "<tr>";
echo "<td>" . $row['column'] . "</td>";
echo "<td>" . $row['type'] . "</td>";
echo "<td>" . $row['value'] . "</td>";
echo "</tr>";
}
}