call_user_func_array有效,但也会给出错误消息

时间:2018-07-23 07:16:01

标签: php sql dynamic prepared-statement

我正在使用准备好的语句创建动态查询(“我简化了下面的代码”)。下面的代码有效,并为我提供了每个客户的名字,但同时也显示以下错误

mysqli_stmt :: bind_param()的参数2应该是参考,第46行的***** .. php中给出的值警告:mysqli_stmt :: bind_param()的参数3应该是参考,值在第46行的*****。php中给出

有人可以解释如何解决此问题,以使错误不会显示吗?

预先感谢

$stringtest = "pupid=? or pupid = ?";
$b = "145854337362";
$c = "141358329270";
$g=array("ss", $c, $b);  

if ($customerdets = $customerdetailsconn ->prepare("SELECT firstname from customers where $stringtest")){                           
       call_user_func_array(array($customerdets, 'bind_param'), $g);
       $customerdets->execute();
       $customerdetsresult = $customerdets->get_result();
       if ($customerdetsresult->num_rows > 0) {
                                        while ($customerlist=mysqli_fetch_array($customerdetsresult)){
                                            echo $customerlist['firstname']." ";
                                        }

                                    }

                                }

0 个答案:

没有答案