我知道我的表中有兩行數據符合where子句的條件,但我的編碼只輸出(回顯)一行。我究竟做錯了什麼?MySQL SELECT語句只返回一行
<?php
$connect= mysqli_connect("localhost", "root", "", "friends_list")
or die('error connecting with the database');
$query= "SELECT * FROM people WHERE age=19";
$result= mysqli_query($connect, $query)
or die('error querying the database');
$row= mysqli_fetch_array($result);
while ($row = mysqli_fetch_array($result))
{
echo $row['first_name'] . " " . $row['last_name'] . " is " . $row['age'] . "<br/>"
}
mysqli_close($connect);
?>