$sql = "SELECT * FROM today WHERE heading='$heading' and day='$day'";
$sql1 = "SELECT * FROM today WHERE day='$day'";
$result = $conn->query($sql);
$result1 = $conn->query($sql1);
if ($result->num_rows > 0) {
echo "
".$row["heading"]."
".while($row = $result1->fetch_assoc())
{echo';}
.}";
我一直在使用while循环从表中获取数据.我的连接工作是完美的,但我需要在第一个无效的另一个循环.这不是好方法吗?
更新:我试图完成回声并再次启动如下,但仍然是一个错误
while($row = $result->fetch_assoc()) {
echo "
"
.$row["heading"].
"
Age: $age
Date of birth: "
.$row["day"].
"-"
.$row["month"].
"-"
.$row["year"].
"
"
.$row["description"].
"
}
echo "
} else {
echo "No table found";
}
$conn->close();