<legend id='0LoUD'><style id='0LoUD'><dir id='0LoUD'><q id='0LoUD'></q></dir></style></legend><tfoot id='0LoUD'></tfoot>

      <small id='0LoUD'></small><noframes id='0LoUD'>

      <i id='0LoUD'><tr id='0LoUD'><dt id='0LoUD'><q id='0LoUD'><span id='0LoUD'><b id='0LoUD'><form id='0LoUD'><ins id='0LoUD'></ins><ul id='0LoUD'></ul><sub id='0LoUD'></sub></form><legend id='0LoUD'></legend><bdo id='0LoUD'><pre id='0LoUD'><center id='0LoUD'></center></pre></bdo></b><th id='0LoUD'></th></span></q></dt></tr></i><div id='0LoUD'><tfoot id='0LoUD'></tfoot><dl id='0LoUD'><fieldset id='0LoUD'></fieldset></dl></div>
      • <bdo id='0LoUD'></bdo><ul id='0LoUD'></ul>

    1. MySQLI 使用 call_user_func_array 绑定参数

      时间:2023-07-31
        <tbody id='Wx7a0'></tbody>
    2. <tfoot id='Wx7a0'></tfoot>

        <legend id='Wx7a0'><style id='Wx7a0'><dir id='Wx7a0'><q id='Wx7a0'></q></dir></style></legend>

            <small id='Wx7a0'></small><noframes id='Wx7a0'>

            • <bdo id='Wx7a0'></bdo><ul id='Wx7a0'></ul>

            • <i id='Wx7a0'><tr id='Wx7a0'><dt id='Wx7a0'><q id='Wx7a0'><span id='Wx7a0'><b id='Wx7a0'><form id='Wx7a0'><ins id='Wx7a0'></ins><ul id='Wx7a0'></ul><sub id='Wx7a0'></sub></form><legend id='Wx7a0'></legend><bdo id='Wx7a0'><pre id='Wx7a0'><center id='Wx7a0'></center></pre></bdo></b><th id='Wx7a0'></th></span></q></dt></tr></i><div id='Wx7a0'><tfoot id='Wx7a0'></tfoot><dl id='Wx7a0'><fieldset id='Wx7a0'></fieldset></dl></div>

                本文介绍了MySQLI 使用 call_user_func_array 绑定参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                请看下面我的代码.我试图将一组参数绑定到我准备好的语句.我一直在网上环顾四周,可以看到我必须使用 call_user_func_array 但无法让它工作.我得到的错误是:第一个参数应该是一个有效的回调,给出了'Array'"我可能是错的,但我假设第一个参数可以是一个数组,并且这个错误消息可能具有误导性.我认为问题在于我的阵列在某种程度上有问题.谁能看到我做错了什么?谢谢.

                $type = array("s", "s");$param = array("string1","anotherstring");$stmt = $SQLConnection->prepare("INSERT INTO mytable (comp, addl) VALUES (?,?)");$params = array_merge($type, $param);call_user_func_array(array(&$stmt, 'bind_param'), $params);$SQLConnection->execute();

                解决方案

                我不知道你为什么必须使用 call_user_func_array,但那是另一回事了.

                在我看来,唯一可能出错的是您使用了对对象的引用.假设您使用的是 PHP 5.*,则没有必要:

                call_user_func_array(array($stmt, 'bind_param'), $params);

                Please see below my code. I am attempting to bind an array of paramenters to my prepared statement. I've been looking around on the web and can see I have to use call_user_func_array but cannot get it to work. The error I get is: "First argument is expected to be a valid callback, 'Array' was given" I may be wrong but I'm assuming the first argument can be an an array and perhaps this error message is misleading. I think the issue is that my array is in someway at fault. Can anyone see what I am doing wrong? Thanks.

                $type = array("s", "s");
                $param = array("string1","anotherstring");
                
                $stmt = $SQLConnection->prepare("INSERT INTO mytable (comp, addl) VALUES (?,?)");
                
                $params = array_merge($type, $param);
                
                call_user_func_array(array(&$stmt, 'bind_param'), $params);
                $SQLConnection->execute();
                

                解决方案

                I wouldn't know why you have to use call_user_func_array, but that's another story.

                The only thing that could be wrong in my eyes is that you are using a reference to the object. Assuming you're using PHP 5.*, that is not necessary:

                call_user_func_array(array($stmt, 'bind_param'), $params);
                

                这篇关于MySQLI 使用 call_user_func_array 绑定参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:Php mysqi bind_param 变量数与准备好的语句中的参数 下一篇:如何将多个参数绑定到 MySQLi 查询

                相关文章

                最新文章

              • <legend id='PeT9B'><style id='PeT9B'><dir id='PeT9B'><q id='PeT9B'></q></dir></style></legend>
              • <i id='PeT9B'><tr id='PeT9B'><dt id='PeT9B'><q id='PeT9B'><span id='PeT9B'><b id='PeT9B'><form id='PeT9B'><ins id='PeT9B'></ins><ul id='PeT9B'></ul><sub id='PeT9B'></sub></form><legend id='PeT9B'></legend><bdo id='PeT9B'><pre id='PeT9B'><center id='PeT9B'></center></pre></bdo></b><th id='PeT9B'></th></span></q></dt></tr></i><div id='PeT9B'><tfoot id='PeT9B'></tfoot><dl id='PeT9B'><fieldset id='PeT9B'></fieldset></dl></div>

              • <tfoot id='PeT9B'></tfoot>

                <small id='PeT9B'></small><noframes id='PeT9B'>

                      <bdo id='PeT9B'></bdo><ul id='PeT9B'></ul>