我有一个这样的脚本:
$result = array();
$sql = "SELECT DISTINCT Name FROM servers"; //doesn't really matter what this MySQL script is
//storing the same query in two different variables
$result[0] = mysql_query($sql);
$result[1] = $result[0];
for($i = 0; $i < 3; $i++) {
$result[0] = $result[1];
while($ret = mysql_fetch_array($result[0]) {
//run some code
}
}
不幸的是,上面的代码执行一次,然后在下一次迭代中什么也不返回。我究竟做错了什么?