我的php/mysql腳本有問題。它應該只輸出while循環一次,但我得到無限循環和無盡的頁面。PHP MYSQL無盡循環
$query = mysql_query("SELECT * FROM users WHERE username ='".base64_encode($_SESSION['username'])."' LIMIT 1");
$result = mysql_fetch_array($query);
if(empty($result)){
echo "No user... Error";
}else{
while($row = $result){
?>
<a href="index.php?user=<?=$row['id']?>"><?=base64_decode($row['username'])?></a> | <a href="javascript:void(0);" id="logout">Logout</a>
<?php
}
}
我已經嘗試了類似的腳本與這些相同的線條和它完美的作品
$result = mysql_fetch_array($query);
if(empty($result)){
echo "No user... Error";
}else{
while($row = $result){
//Something
}
}
loop http://img249.imageshack.us/img249/70/endlessloop.png
謝謝,第二個示例接受 – nebkat 2010-06-10 11:48:35