<tfoot id='tH22l'></tfoot>

    1. <small id='tH22l'></small><noframes id='tH22l'>

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

        PHP 绑定通配符

        时间:2023-07-30

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

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

                  <legend id='pNIE2'><style id='pNIE2'><dir id='pNIE2'><q id='pNIE2'></q></dir></style></legend>
                1. 本文介绍了PHP 绑定通配符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  希望有人能帮助我了解当变量值旁边需要多字符通配符时如何在 mysqli 中绑定参数.我发现它在创建 SQL 语句时对我有用,如下所示:

                  Hope Somebody will help me about how I bind a parameter in mysqli when a multiple character wildcard needs to be next to the variable value. I found that it worked for me when creating a SQL statement, like this:

                  $sql = "SELECT item_title FROM item WHERE item_title LIKE '%$title%'";
                  

                  但是,我尝试按照相同的模式绑定变量,发现它失败了.他们使用了这个代码:

                  However, I tried to bind the variable following the same pattern, and found that it failed. They used this code:

                  $sql = "SELECT item_title FROM item WHERE item_title LIKE '%?%'";
                  

                  它引发了这个错误:

                  警告:mysqli_stmt_bind_param() [function.mysqli-stmt-bind-param]:变量数与准备好的参数数不匹配在线program_name中的语句......

                  Warning: mysqli_stmt_bind_param() [function.mysqli-stmt-bind-param]: Number of variables doesn't match number of parameters in prepared statement in program_name on line......

                  谁能告诉我如何解决这个问题?谢谢你.

                  Can anybody tell me how fix this problem? Thank you.

                  推荐答案

                  您只能绑定数据文字,不能绑定任意查询部分.
                  所以,先准备好你的文字

                  You can bind only data literals not arbitrary query parts.
                  So, prepare your literal first

                  $var = "%$var%";
                  $sql = "SELECT item_title FROM item WHERE item_title LIKE ?";
                  

                  这篇关于PHP 绑定通配符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:致命错误:在将 PHP 5.4.22 和 MySQL 5.5 与 Apache 2.4.7 下一篇:弃用的 MySql 函数

                  相关文章

                  最新文章

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

                  1. <legend id='HP0Db'><style id='HP0Db'><dir id='HP0Db'><q id='HP0Db'></q></dir></style></legend>

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

                      <tfoot id='HP0Db'></tfoot>