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

        <small id='7H4We'></small><noframes id='7H4We'>

          <bdo id='7H4We'></bdo><ul id='7H4We'></ul>
      1. 警告:mysqli_free_result() 期望参数 1 是 mysqli_result,

        时间:2023-07-29
        • <i id='ulmBL'><tr id='ulmBL'><dt id='ulmBL'><q id='ulmBL'><span id='ulmBL'><b id='ulmBL'><form id='ulmBL'><ins id='ulmBL'></ins><ul id='ulmBL'></ul><sub id='ulmBL'></sub></form><legend id='ulmBL'></legend><bdo id='ulmBL'><pre id='ulmBL'><center id='ulmBL'></center></pre></bdo></b><th id='ulmBL'></th></span></q></dt></tr></i><div id='ulmBL'><tfoot id='ulmBL'></tfoot><dl id='ulmBL'><fieldset id='ulmBL'></fieldset></dl></div>
              <tbody id='ulmBL'></tbody>

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

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

                  <tfoot id='ulmBL'></tfoot><legend id='ulmBL'><style id='ulmBL'><dir id='ulmBL'><q id='ulmBL'></q></dir></style></legend>

                  本文介绍了警告:mysqli_free_result() 期望参数 1 是 mysqli_result,给定的布尔值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  为什么我会收到此错误消息:

                  Why am I getting this error message:

                  警告:mysqli_free_result() 期望参数 1 是 mysqli_result,给出布尔值

                  Warning: mysqli_free_result() expects parameter 1 to be mysqli_result, boolean given

                  我的代码是:

                  $statement = "INSERT INTO table1 (data1, data2) VALUES ('$variable1', '$variable2')";
                  
                  if ($result = mysqli_query($conn,$statement)) {
                  echo "New record added successfully";
                            } else {
                      echo "Error adding records: " . $result . "<br>" . mysqli_error($conn);
                  }
                  
                  echo "Adding records finished. ";
                  
                  mysqli_free_result($result);
                  

                  推荐答案

                  如中所述mysqli_query 手册:

                  失败时返回 FALSE.对于成功的 SELECT、SHOW、DESCRIBE 或 EXPLAIN 查询,mysqli_query() 将返回一个 mysqli_result 对象.对于其他成功的查询,mysqli_query() 将返回 TRUE.

                  Returns FALSE on failure. For successful SELECT, SHOW, DESCRIBE or EXPLAIN queries mysqli_query() will return a mysqli_result object. For other successful queries mysqli_query() will return TRUE.

                  您的插入查询将返回 true 或 false,但不会返回对象.因此,调用 mysqli_free_result 在这里不起作用.

                  Your insert query will return true or false, but not an object. So, calling mysqli_free_result will not work here.

                  这篇关于警告:mysqli_free_result() 期望参数 1 是 mysqli_result,给定的布尔值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:PHP 中的 mysqli 类是否可以 100% 保护 sql 注入? 下一篇:CodeIgniter Active Record:一次加载一行

                  相关文章

                  最新文章

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

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

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