今天我正在读这份文件,当看到输出时我感到很困惑。
代码行:
/* numeric array */
$row = $result->fetch_array(MYSQLI_NUM);
printf ("%s (%s)\n", $row[0], $row[1]);
/* associative array */
$row = $result->fetch_array(MYSQLI_ASSOC);
printf ("%s (%s)\n", $row["Name"], $row["CountryCode"]);
/* associative and numeric array */
$row = $result->fetch_array(MYSQLI_BOTH);
printf ("%s (%s)\n", $row[0], $row["CountryCode"]);产生的结果:
Kabul (AFG)
Qandahar (AFG)
Herat (AFG)如果循环和data_seek()组合在一起,那么我可以理解为什么每次输出是不同的。上面代码的输出不应该这样吗?
Kabul (AFG)
Kabul (AFG)
Kabul (AFG)我是不是遗漏了什么?
发布于 2015-10-17 08:53:43
你只需要进一步调查。页面上说这个函数“是mysqli_fetch_row()的扩展版本”,而通过遵循链接,您将了解到“对该函数的每个后续调用都将返回结果集中的下一行”
https://stackoverflow.com/questions/33184408
复制相似问题