-3
My While循環在下面的代碼中不起作用。當我註釋掉while行和兩個括號時,while循環中的所有內容都回聲良好。只要我取消註釋while循環並再次運行它,我就沒有錯誤,但所有內部回聲都消失了。PHP while while循環未執行
case 'search':
echo "searching".$firstname;
$sqlsearch="SELECT * FROM Customer WHERE firstname='$firstname'";
$sim = mysql_query($conndb, $sqlsearch);
while($row = mysql_fetch_array($sim))
{
echo "firstname: ".$row['firstname']."<br>";
echo "lastname: ".$row['lastname']."<br>";
echo "phone: ".$row['phone']."<br>";
echo "address: ".$row['address']."<br>";
echo "city: ".$row['city']."<br>";
echo "state: ".$row['state']."<br>";
echo "zip: ".$row['zip']."<br>";
echo $sqlsearch;
}
echo "<br>";
echo "seaching 2";
break;
做了'回聲$ firstname'生產什麼? – James
不,除非你註釋掉while部分,while循環裏面什麼都沒有執行。 – user519670
以上代碼中的第二行代碼。即'$ firstname'在它遇到查詢之前是否保存了任何值? – James