我在做什么错?
这是我的代码:
<?php
$db=mysqli_connect("xxxxxx","xxxxxxx","","xxxxxxx");
$sql="SELECT* from flyreise";
$result=mysqli_query($db,$sql);
echo "<table>";
echo "<tr>";
echo "<th></th>";
echo "</tr>";
echo "<tr>";
$countRows=mysqli_affected_rows($db);
for($i=0;$i<$countRows;$i++){
$row=mysqli_fetch_array($result);
echo "<td><strong>From:</strong>".$row["fra"]." <br><strong>To:</strong> ".$row["til"]." <br><strong>Date:</strong> ".$row["dato"]." <br><strong>Clock:</strong> ".$row["klokkeslett"]."</td>";
echo "<td></td>";
echo "<td></td>";
}
echo "</tr>";
echo "</table>";
?>
答案 0 :(得分:0)
为此替换const completed = Challenge.aggregate([],(err,results) =>{
console.log(results)
})
循环:
for
您要告诉您的程序继续循环访问while($row=mysqli_fetch_array($result)){
echo "<td><strong>From:</strong>".$row["fra"]." <br><strong>To:</strong>
".$row["til"]." <br><strong>Date:</strong> ".$row["dato"]." <br><strong>Clock:
</strong> ".$row["klokkeslett"]."</td>";
echo "<td></td>";
echo "<td></td>";
}
并将获取的记录分配给mysql_fetch_array($result)
。
此外,不要忘记删除此行$row
,因为您不再需要它。