pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

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

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

        <bdo id='uulQO'></bdo><ul id='uulQO'></ul>
    1. <legend id='uulQO'><style id='uulQO'><dir id='uulQO'><q id='uulQO'></q></dir></style></legend>
    2. <tfoot id='uulQO'></tfoot>

    3. PHP mysqli 命令不同步;你現(xiàn)在不能運(yùn)行這個(gè)命令

      PHP mysqli Commands out of sync; you can#39;t run this command now(PHP mysqli 命令不同步;你現(xiàn)在不能運(yùn)行這個(gè)命令)

        <tfoot id='O58CQ'></tfoot>
            <bdo id='O58CQ'></bdo><ul id='O58CQ'></ul>
          • <small id='O58CQ'></small><noframes id='O58CQ'>

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

                  <tbody id='O58CQ'></tbody>
              • 本文介紹了PHP mysqli 命令不同步;你現(xiàn)在不能運(yùn)行這個(gè)命令的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                問題描述

                在我的數(shù)據(jù)庫中,我有一些存儲(chǔ)過程.

                In my db I have some stored procedures.

                我想打電話給其中一個(gè),根據(jù)我從這個(gè)程序得到的結(jié)果,我會(huì)決定天氣是否打電話給第二個(gè).

                I want to call the one of them, and according to the results I get from this procedure, i will determine weather to call the second one or not.

                正如您在 isUserValid() 方法中看到的,我使用了 $result->free_results()

                As you can see in the isUserValid() method I've used $result->free_results()

                但仍然在調(diào)用另一個(gè)過程時(shí)我得到:命令不同步;你現(xiàn)在不能運(yùn)行這個(gè)命令

                but still when calling the other procedure I get: Commands out of sync; you can't run this command now

                這是我對(duì) db 函數(shù)的調(diào)用:

                This is my calling to the db functions:

                    /**
                     * Run a new query on the db.
                     * this will open an close the connection to the db
                     * @param $query string the query to run
                     * @param $verifyAccessToken boolean true if user validation is needed before query is executed, false otherwise
                     * @return bool|mysqli_result the result of the query if any or true or false in a non query
                     * @throws Exception on connection and query errors
                     */
                    private function queryDb($query,$verifyAccessToken)
                    {
                       // if ($this->test)
                //            echo $query . "<br>";
                        //create a new mysqli connection
                        $mysqli = new mysqli($this->DB_HOST, $this->DB_USER, $this->DB_PASS, $this->DB_NAME);
                        //set the charset for the connection
                        if (!$mysqli->set_charset("utf8"))
                        {
                            $mysqli->close();
                            throw new Exception ("Error setting UTF 8 DB connection");
                        }
                        //check if the connection was ok
                        if (mysqli_connect_errno())
                        {
                            $mysqli->close();
                            throw new Exception("Error connecting DB");
                        }
                
                        //if verification is needed - verify access token
                       if ($verifyAccessToken && !$this->isUserValid($mysqli))
                       {
                          $mysqli->close();
                          throw new Exception(ACCESS_TOKEN_INCORRECT);
                       }
                
                        //get results
                        $result = $mysqli->query($query);
                        //check if there were now error in query. if so - throw an exception
                        if (!$result)
                        {
                            $mysqlError = $mysqli->error . __LINE__;
                            //close the connection
                            $mysqli->close();
                            throw new Exception ("mySQL Error: " . $mysqlError);
                        }
                        //fetch the results into an array
                        $rows = $result->fetch_all(MYSQLI_BOTH);
                        //close the connection
                        $result->close();
                        $result->free();
                        $mysqli->close();
                        //return the results if any
                        return $rows;
                    }
                
                    /**
                     * Check if user is valid
                     * @param $mysqli mysqli connection to db
                     * @return true if user is valid, false otherwise
                     */
                    function isUserValid($mysqli)
                    {
                        //Check if there is a saved access token. if not - throw an exception
                        if (is_null($this->user) || $this->user->getPicoAccessToken() == null)
                          throw new Exception(ACCESS_TOKEN_INCORRECT);
                        //get user details
                        $facebookId = $this->user->getFacebookId();
                        $picoAccessToken = $this->user->getPicoAccessToken();
                        //create verification query
                        $verificationQuery = "Call isUserValid('$facebookId','$picoAccessToken')";
                        //execute query
                        $result = $mysqli->query($verificationQuery);
                
                        //if query had error - throw exception
                        if (!$result)
                        {
                         $mysqlError = $mysqli->error . __LINE__;
                         //close the connection
                         $mysqli->close();
                         throw new Exception ("mySQL Error: " . $mysqlError);
                        }
                        $rows = $result->fetch_all(MYSQLI_ASSOC);
                        $rows = $rows[0];
                        $result->free_result();
                        //return user valid status
                        return isset($rows["isUserValid"]) && $rows["isUserValid"] == 1;
                    }
                

                推薦答案

                每個(gè)存儲(chǔ)過程至少返回兩個(gè)結(jié)果

                Every stored procedure returns at least two results

                • 一個(gè)(或多個(gè))實(shí)際結(jié)果
                • 一個(gè)空的結(jié)果告訴客戶沒有更多的結(jié)果.

                你必須使用 mysqli_more_results()/mysqli_next_result() 來清理它們.

                You have to use mysqli_more_results()/mysqli_next_result() to clean them.

                如果您的過程只返回一個(gè)結(jié)果,或者您只想要第一個(gè)結(jié)果之外的任何額外結(jié)果,您可以使用以下代碼片段清理結(jié)果隊(duì)列:

                If your procedure returns only one result, or you just don't want any extra results but the first one, you can clean up the results queue with this code snippet:

                while($mysqli->more_results())
                {
                    $mysqli->next_result();
                    if($res = $mysqli->store_result())
                    {
                        $res->free(); 
                    }
                }
                

                這篇關(guān)于PHP mysqli 命令不同步;你現(xiàn)在不能運(yùn)行這個(gè)命令的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

                相關(guān)文檔推薦

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

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

                          <bdo id='ML01P'></bdo><ul id='ML01P'></ul>
                          <legend id='ML01P'><style id='ML01P'><dir id='ML01P'><q id='ML01P'></q></dir></style></legend>
                        • <tfoot id='ML01P'></tfoot>
                          主站蜘蛛池模板: 今日热点_实时热点_奇闻异事_趣闻趣事_灵异事件 - 奇闻事件 | PE一体化污水处理设备_地埋式生活污水净化槽定制厂家-岩康塑业 | 壹作文_中小学生优秀满分作文大全 | 深圳展厅设计_企业展馆设计_展厅设计公司_数字展厅设计_深圳百艺堂 | 工程管道/塑料管材/pvc排水管/ppr给水管/pe双壁波纹管等品牌管材批发厂家-河南洁尔康建材 | 矿用履带式平板车|探水钻机|气动架柱式钻机|架柱式液压回转钻机|履带式钻机-启睿探水钻机厂家 | 报警器_家用防盗报警器_烟雾报警器_燃气报警器_防盗报警系统厂家-深圳市刻锐智能科技有限公司 | 首页|专注深圳注册公司,代理记账报税,注册商标代理,工商变更,企业400电话等企业一站式服务-慧用心 | 上海小程序开发-上海小程序制作公司-上海网站建设-公众号开发运营-软件外包公司-咏熠科技 | 灌木树苗-绿化苗木-常绿乔木-价格/批发/基地 - 四川成都途美园林 | 成都珞石机械 - 模温机、油温机、油加热器生产厂家 | bng防爆挠性连接管-定做金属防爆挠性管-依客思防爆科技 | 电动高尔夫球车|电动观光车|电动巡逻车|电动越野车厂家-绿友机械集团股份有限公司 | 祝融环境-地源热泵多恒系统高新技术企业,舒适生活环境缔造者! | 合肥升降机-合肥升降货梯-安徽升降平台「厂家直销」-安徽鼎升自动化科技有限公司 | 污水处理设备,一体化泵站,一体化净水设备-「梦之洁环保设备厂家」 | 大学食堂装修设计_公司餐厅效果图_工厂食堂改造_迈普装饰 | 二手色谱仪器,十万分之一分析天平,蒸发光检测器,电位滴定仪-湖北捷岛科学仪器有限公司 | 全自动贴标机-套标机-工业热风机-不干胶贴标机-上海厚冉机械 | 彼得逊采泥器-定深式采泥器-电动土壤采样器-土壤样品风干机-常州索奥仪器制造有限公司 | 厦门ISO认证|厦门ISO9001认证|厦门ISO14001认证|厦门ISO45001认证-艾索咨询专注ISO认证行业 | 磁粉制动器|张力控制器|气胀轴|伺服纠偏控制器整套厂家--台灵机电官网 | 小型气象站_便携式自动气象站_校园气象站-竞道气象设备网 | 齿式联轴器-弹性联轴器-联轴器厂家-江苏诺兴传动联轴器制造有限公司 | 水压力传感器_数字压力传感器|佛山一众传感仪器有限公司|首页 | 清水-铝合金-建筑模板厂家-木模板价格-铝模板生产「五棵松」品牌 | 超声波流量计_流量标准装置生产厂家 _河南盛天精密测控 | 武汉高温老化房,恒温恒湿试验箱,冷热冲击试验箱-武汉安德信检测设备有限公司 | 小程序开发公司-小程序制作-微信小程序开发-小程序定制-咏熠软件 | 标准件-非标紧固件-不锈钢螺栓-非标不锈钢螺丝-非标螺母厂家-三角牙锁紧自攻-南京宝宇标准件有限公司 | 动物麻醉机-数显脑立体定位仪-北京易则佳科技有限公司 | 咖啡加盟-咖啡店加盟-咖啡西餐厅加盟-塞纳左岸咖啡西餐厅官网 | 软装设计-提供软装装饰和软装配饰及软装陈设的软装设计公司 | 炒货机-炒菜机-炒酱机-炒米机@霍氏机械 | 换网器_自动换网器_液压换网器--郑州海科熔体泵有限公司 | 温湿度记录纸_圆盘_横河记录纸|霍尼韦尔记录仪-广州汤米斯机电设备有限公司 | 汝成内控-行政事业单位内部控制管理服务商 | 酒万铺-酒水招商-酒水代理| 包装盒厂家_纸盒印刷_礼品盒定制-济南恒印包装有限公司 | 建筑资质代办-建筑企业资质代办机构-建筑资质代办公司 | 耐高温风管_耐高温软管_食品级软管_吸尘管_钢丝软管_卫生级软管_塑料波纹管-东莞市鑫翔宇软管有限公司 |