PHP fetch_row限制结果
问题描述:
我有一个表与行,但由于某种原因,它只填充14行。我有大约800行的数据库。有任何想法吗?PHP fetch_row限制结果
代码:
$result = mysqli_query($con,"SELECT * FROM translation ORDER BY id");
while($row = mysqli_fetch_row($result) and $property = mysqli_fetch_field($result))
{
echo "<tr>";
foreach($row as $column => $value) {
// $column is column name 'englsih', 'spanish' etc.
$name = $property->name;
echo "<td align='left' class='cell".$column."'>". $value . "</td>";
}
echo "<td><span class='edit_b'></span><span class='remove_b'></span></td></tr>";
}
echo "</thead></table>";
答
我假设你translation
表有14列?
问题是这样的:
... and $property = mysqli_fetch_field($result))
您获取关于你的结果集的列的信息 - 甚至不会使用它 - 只要你已经通过了最后一列,这将返回false
你的循环会结束。
不要获取有关与主要结果循环相同的循环中的列的信息。
我想通了。我在别的地方使用它,并注意到我不在这个循环中使用它... – Grasper 2014-11-03 21:03:05