[英]Converting mysql to mysqli functions and getting parameter error
I'm new to mysqli and am upgrading all my code to use it. 我是mysqli的新手,正在升级我的所有代码以使用它。
I understand functions now need to have the $conn
variable included with them. 我知道函数现在需要包含
$conn
变量。
Here is my code: 这是我的代码:
$query = "SELECT * FROM...";
$result = mysqli_query ($conn, $query);
while ($row = mysqli_fetch_array($conn, $result)) {
}
I'm getting the error: 我收到错误消息:
PHP Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result
and I can't figure out what I'm missing. 我无法弄清楚我所缺少的。
and I can't figure out what I'm missing.
我无法弄清楚我所缺少的。
Missing? 失踪? Nothing.
没有。 Extra?
额外? :)
:)
mysqli_fetch_array
will take $result
, which already knows about $conn
; mysqli_fetch_array
将花费$result
,该$result
已经知道了$conn
; so mysqli_fetch_array($result)
is correct, and adding $conn
confuses it. 所以
mysqli_fetch_array($result)
是正确的,添加$conn
mysqli_fetch_array($result)
它迷惑。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.