久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

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

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

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

      如何在 php 中使用 bind_result() 而不是 get_result()

      How to use bind_result() instead of get_result() in php(如何在 php 中使用 bind_result() 而不是 get_result())

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

                <tbody id='BSaRU'></tbody>
              • <small id='BSaRU'></small><noframes id='BSaRU'>

              • 本文介紹了如何在 php 中使用 bind_result() 而不是 get_result()的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                我正在為 uni 開發一個項目,并且一直在 testing server 上使用以下代碼從基于 的表中獲取所有設備user_id:

                I'm working on a project for uni and have been using the following code on a testing server to get all devices from a table based on a user_id:

                public function getAllDevices($user_id) {
                    $stmt = $this->conn->prepare("SELECT * FROM devices WHERE  primary_owner_id = ?");
                    $stmt->bind_param("i", $user_id);
                    $stmt->execute();
                    $devices = $stmt->get_result();
                    $stmt->close();
                    return $devices;
                }
                

                這在我的測試服務器上運行良好,但在遷移到大學項目服務器時返回此錯誤:

                This worked fine on my testing server but returns this error when migrating over to the university project server:

                Call to undefined method mysqli_stmt::get_result()
                

                一些谷歌搜索建議使用 bind_result() 而不是 get_result() 但我不知道如何在表中執行此all fields.大多數示例只顯示返回 one field

                Some googling suggests using bind_result() instead of get_result() but I have no idea how to do this all fields in the table. Most examples only show returning one field

                任何幫助將不勝感激

                推薦答案

                假設你不能使用 get_result() 并且你想要一個設備數組,你可以這樣做:

                Assuming you can't use get_result() and you want an array of devices, you could do:

                public function getAllDevices($user_id) {
                    $stmt = $this->conn->prepare("SELECT device_id, device_name, device_info FROM devices WHERE  primary_owner_id = ?");
                    $stmt->bind_param("i", $user_id);
                    $stmt->execute();
                    $stmt->bind_result($id, $name, $info);
                    $devices = array();
                
                    while($stmt->fetch()) {
                        $tmp = array();
                        $tmp["id"] = $id;
                        $tmp["name"] = $name;
                        $tmp["info"] = $info;
                        array_push($devices, $tmp);
                    }
                    $stmt->close();
                    return $devices;
                }
                

                這會創建一個臨時數組并存儲其中每一行的數據,然后將其推送到主數組.據我所知,您不能在 bind_result() 中使用 SELECT *.相反,您將不得不在 SELECT

                This creates a temporary array and stores the data from each row in it, and then pushes it to the main array. As far as I'm aware, you can't use SELECT * in bind_result(). Instead, you will annoyingly have to type out all the fields you want after SELECT

                這篇關于如何在 php 中使用 bind_result() 而不是 get_result()的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                相關文檔推薦

                store_result() and get_result() in mysql returns false(mysql 中的 store_result() 和 get_result() 返回 false)
                Call to undefined function mysqli_result::num_rows()(調用未定義的函數 mysqli_result::num_rows())
                PHP Prepared Statement Problems(PHP 準備好的語句問題)
                mysqli_fetch_array returning only one result(mysqli_fetch_array 只返回一個結果)
                PHP MySQLi Multiple Inserts(PHP MySQLi 多次插入)
                How do I make sure that values from MySQL keep their type in PHP?(如何確保 MySQL 中的值在 PHP 中保持其類型?)
                  <bdo id='UHbo9'></bdo><ul id='UHbo9'></ul>
                  • <tfoot id='UHbo9'></tfoot>

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

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

                          <legend id='UHbo9'><style id='UHbo9'><dir id='UHbo9'><q id='UHbo9'></q></dir></style></legend>
                          主站蜘蛛池模板: 在线观看国产视频 | 亚洲一区二区三区四区五区中文 | 91在线电影| 日韩在线欧美 | 国产欧美精品一区二区三区 | 午夜视频在线免费观看 | 亚洲一区国产精品 | 天天视频一区二区三区 | 久久99精品国产 | 男女啪啪网址 | 国产视频福利一区 | 99re在线免费视频 | 亚洲精品一区二三区不卡 | 神马久久av | 国产黄色在线 | 欧美在线一区二区三区四区 | 欧美精品久久久久久 | 日韩欧美一区二区三区四区 | 国产免费观看久久黄av片涩av | 亚洲97| 日韩一区二区在线视频 | 亚洲成av人片在线观看无码 | 久久久国产一区二区三区 | 日本a∨精品中文字幕在线 亚洲91视频 | 黄a在线观看| 成人精品免费视频 | 涩涩视频在线看 | 一级片网站视频 | 国产精品国产自产拍高清 | 日本不卡免费新一二三区 | 中文字幕第一页在线 | 亚洲精品第一国产综合野 | 国产精品久久久久久久久久久久冷 | 天天色图 | 日韩中文字幕 | 日韩美女一区二区三区在线观看 | 精品久久久久久红码专区 | 亚洲最新在线视频 | 在线免费看黄 | 国产亚洲精品精品国产亚洲综合 | 国产一区二区三区在线 |