<tfoot id='B0EFo'></tfoot>

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

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

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

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

        PHP mysqli准备语句不起作用

        时间:2023-07-30

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

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

                    <tbody id='dNDGX'></tbody>
                  本文介绍了PHP mysqli准备语句不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我正在使用 mysqli prepare 语句来查询具有多个约束的数据库.我已经在我的测试文件中运行了代码,它运行良好.但是,当我将代码移至实时文件时,它会引发以下错误:

                  I am using a mysqli prepare statement to query my db with multiple constraints. I have ran the code in a test file of mine and it works perfectly fine. However, when I move the code over to my live file it throws the error below:

                  PHP 警告:mysqli_stmt::bind_result():绑定变量的数量与准备好的语句中的字段数不匹配C:wampwwwfirecomfirecom.php 80 行

                  PHP Warning: mysqli_stmt::bind_result(): Number of bind variables doesn't match number of fields in prepared statement in C:wampwwwfirecomfirecom.php on line 80

                  PHP 注意:未定义变量:导致C:wampwwwfirecomfirecom.php 第 89 行

                  PHP Notice: Undefined variable: results in C:wampwwwfirecomfirecom.php on line 89

                  两个参数都设置正确,但有些东西把它扔掉了.

                  Both parameters are being set correctly but something is throwing it off.

                  代码:

                  $query = $mysqli->prepare("SELECT * FROM calls WHERE wcccanumber = ? && county = ?");
                  $query->bind_param("ss", $wcccanumber, $county);
                  $query->execute();
                  
                  $meta = $query->result_metadata();
                  
                  while ($field = $meta->fetch_field()) {
                      $parameters[] = &$row[$field->name];
                  }
                  
                  call_user_func_array(array($query, 'bind_result'), $parameters);
                  
                  while ($query->fetch()) {
                      foreach($row as $key => $val) {
                          $x[$key] = $val;
                      }
                      $results[] = $x;
                  }
                  
                  print_r($results['0']);
                  

                  $query var_dump:

                  $query var_dump:

                  object(mysqli_stmt)#27 (10) { ["affected_rows"]=> int(-1) ["insert_id"]=> int(0) ["num_rows"]=> int(0) ["param_count"]=> int(2) ["field_count"]=> int(13) ["errno"]=> int(0) ["error"]=> string(0) "" ["error_list"]=> array(0) { } ["sqlstate"]=> string(5) "00000" ["id"]=> int(1) }
                  

                  推荐答案

                  为什么要用 mysqli 折磨自己?
                  在 PDO 中,您不需要这些可怕的代码,只需要一行代码即可获得结果

                  Why torture yourself with mysqli?
                  In PDO you will need none of these horrendous codes, but only one line to get the results

                  $query = $pdo->prepare("SELECT * FROM calls WHERE wcccanumber = ? && county = ?");
                  $query->execute(array($wcccanumber, $county));
                  $results = $query->fetchAll();
                  print_r($results[0]);
                  

                  这篇关于PHP mysqli准备语句不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:是否可以将 store_result() 和 bind_result() 与 PHP PDO 一 下一篇:调用非对象上的成员函数 bind_param()(尽管经过研究

                  相关文章

                  最新文章

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

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

                  1. <tfoot id='qm5VE'></tfoot>

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