【问题标题】:<br /><b>Warning</b>: mysqli_fetch_array() expects parameter 1 to be mysqli_result, bool [duplicate]<br /><b>警告</b>:mysqli_fetch_array() 期望参数 1 为 mysqli_result,bool [重复]
【发布时间】:2022-11-28 08:10:16
【问题描述】:

我的代码是这样的

function user($a,$field,$id)

{

$selectruser=mysqli_query($a,"select `$field` from `tbl_user` where `id`='".$id."'");

$userresult=mysqli_fetch_array($selectruser);

return $userresult["$field"];
}

我希望没有错误但不完美请检查并解决

【问题讨论】:

  • 您假设您的查询总是成功的。这通常是个坏主意。

标签: php mysql


【解决方案1】:

只需回显您的 sql 查询并检查代码的输出。

【讨论】:

    猜你喜欢
    • 2015-03-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-01-05
    • 2023-03-13
    • 2016-02-29
    • 2013-03-04
    相关资源
    最近更新 更多