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

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

        <tfoot id='Wr0Pq'></tfoot>

        php 警告:mysqli_close() 期望参数 1 是 mysqli

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

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

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

                  问题描述

                  我正在尝试通过 php 连接到 sql 数据库,并不断收到我无法弄清楚的错误.我可以连接另一个调试脚本而没有错误.我获得了连接并提取了我的数据,但最后却出现了错误.

                  I am attempting a connection to a sql db via php and keep getting an error I can't figure out. I can connect with another debug scripts with no errors. I get my connection and pull my data but pulls an error at the end.

                  $con=mysqli_connect("localhost","username","password","dbname");
                   
                  // Check connection
                  if (mysqli_connect_errno())
                  {
                    echo "Failed to connect to MySQL: " . mysqli_connect_error();
                  }
                   
                  // This SQL statement selects ALL from the table 'Locations'
                  $sql = "SELECT * FROM Locations";
                   
                  // Check if there are results
                  if ($result = mysqli_query($con, $sql))
                  {
                      // If so, then create a results array and a temporary one
                      // to hold the data
                      $resultArray = array();
                      $tempArray = array();
                   
                      // Loop through each row in the result set
                      while($row = $result->fetch_object())
                      {
                          // Add each row into our results array
                          $tempArray = $row;
                          array_push($resultArray, $tempArray);
                      }
                   
                      // Finally, encode the array to JSON and output the results
                      echo json_encode($resultArray);
                  }
                   
                  // Close connections
                  mysqli_close($result);
                  mysqli_close($con);
                  ?>
                  

                  把这个拿出来

                  [{名称":苹果",地址":1 Infinity Loop Cupertino,CA",纬度":37.331741",经度":-122.0303333""},{"Name":"Googleplex","Address":"1600 Amphitheatre Pkwy, Mountain View, CA","Latitude":"37.421999","Longitude":"-122.083954"}]

                  [{"Name":"Apple","Address":"1 Infinity Loop Cupertino, CA","Latitude":"37.331741","Longitude":"-122.030333"},{"Name":"Googleplex","Address":"1600 Amphitheatre Pkwy, Mountain View, CA","Latitude":"37.421999","Longitude":"-122.083954"}]

                  警告:mysqli_close() 期望参数 1 是 mysqli,对象在/home/jfletch/public_html/appone/connect.php 第 36 行

                  Warning: mysqli_close() expects parameter 1 to be mysqli, object given in /home/jfletch/public_html/appone/connect.php on line 36

                  推荐答案

                  mysqli_close($result);
                  

                  上面的行是不正确的.您只需要调用 mysqli_close() 一次(如果有的话,正如评论中指出的那样,连接在脚本执行结束时关闭)并且参数应该是您的链接标识符,而不是您的查询资源.

                  The line above is incorrect. You only need to call mysqli_close() once (if at all since, as pointed out in the comments, the connection is closed at the end of the execution of your script) and the parameter should be your link identifier, not your query resource.

                  删除它.

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

                  上一篇:如何将多个参数绑定到 MySQLi 查询 下一篇:致命错误:调用未定义的方法 mysqli_result::fetch_al

                  相关文章

                  最新文章

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

                        <bdo id='1t9YH'></bdo><ul id='1t9YH'></ul>

                      <small id='1t9YH'></small><noframes id='1t9YH'>