所以我有代码:
$sql = "SELECT * from users WHERE level = 2";
$result = mysql_query($sql);
while($write = mysql_fetch_array($result)){
echo ''.$write['username'].'';
}
我想让它更简单,所以我这样做:
while($write = mysql_fetch_array(mysql_query("SELECT * from users WHERE level = 2"))){
echo ''.$write['username'].'';
}
为什么第一个代码不是无限循环而第二个代码是?