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

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

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

          <bdo id='jm8yz'></bdo><ul id='jm8yz'></ul>
      1. mysqli::get_result 有什么问题?

        时间:2023-07-30
        • <small id='j289x'></small><noframes id='j289x'>

            <tbody id='j289x'></tbody>
            <legend id='j289x'><style id='j289x'><dir id='j289x'><q id='j289x'></q></dir></style></legend>

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

              • <tfoot id='j289x'></tfoot>
                <i id='j289x'><tr id='j289x'><dt id='j289x'><q id='j289x'><span id='j289x'><b id='j289x'><form id='j289x'><ins id='j289x'></ins><ul id='j289x'></ul><sub id='j289x'></sub></form><legend id='j289x'></legend><bdo id='j289x'><pre id='j289x'><center id='j289x'></center></pre></bdo></b><th id='j289x'></th></span></q></dt></tr></i><div id='j289x'><tfoot id='j289x'></tfoot><dl id='j289x'><fieldset id='j289x'></fieldset></dl></div>
                  本文介绍了mysqli::get_result 有什么问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我有以下代码:

                  $postId = $_GET['postId'];
                  $mysqli = new mysqli('localhost', 'username', 'database', 'name_db');
                  mysqli_report(MYSQLI_REPORT_ALL);
                  
                  $stmt = $mysqli->stmt_init();
                  $stmt->prepare("
                  SELECT *
                  FROM posts
                  WHERE postId = ?
                  ");
                  $stmt->bind_param('i', $postId);
                  $stmt->execute();
                  $result = $stmt->get_result();//Call to undefined method 
                  $info = $result->fetch_array(MYSQLI_ASSOC);
                  echo json_encode($info);
                  

                  我收到了上面标记的一些错误.我做错了什么?

                  And I get some error marked above. What have i done wrong?

                  将 fecth_array() 改为 fetch_array()

                  changed fecth_array() to fetch_array()

                  推荐答案

                  正如其他人所说,它仅在前沿 PHP 中可用.你可以做这样的事情(answer to a类似的问题):

                  As others have stated, it is only available in bleeding edge PHP. You could do something like this (answer to a similar question):

                  function bind_array($stmt, &$row) {
                      $md = $stmt->result_metadata();
                      $params = array();
                      while($field = $md->fetch_field()) {
                          $params[] = &$row[$field->name];
                      }
                  
                      call_user_func_array(array($stmt, 'bind_result'), $params);
                  }
                  
                  // ....
                  bind_array($stmt, $info);
                  $stmt->fetch();
                  
                  echo json_encode($info);
                  

                  或者使用 mysqli::query 如果你有一个简单的查询无参数 - 不要将它与动态生成的 SQL 语句一起使用.

                  Or use mysqli::query if you have a simple query with no parameters - don't use it with dynamically generated SQL-statements.

                  这篇关于mysqli::get_result 有什么问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:mysqli 准备语句,使用绑定参数插入 NULL 下一篇:使用准备好的语句检查电子邮件是否已经在数据

                  相关文章

                  最新文章

                  <tfoot id='POAwR'></tfoot>

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

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

                    1. <legend id='POAwR'><style id='POAwR'><dir id='POAwR'><q id='POAwR'></q></dir></style></legend>
                      • <bdo id='POAwR'></bdo><ul id='POAwR'></ul>