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

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

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

      <tfoot id='YbYiI'></tfoot>

        警告:mysqli_stmt::bind_result():綁定變量的數量與準備

        Warning: mysqli_stmt::bind_result(): Number of bind variables doesn#39;t match number of fields in prepared statement error(警告:mysqli_stmt::bind_result():綁定變量的數量與準備好的語句錯誤中的字段數量不匹配) - IT屋
        <legend id='9QZLY'><style id='9QZLY'><dir id='9QZLY'><q id='9QZLY'></q></dir></style></legend>

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

          <small id='9QZLY'></small><noframes id='9QZLY'>

            • <tfoot id='9QZLY'></tfoot>
                <bdo id='9QZLY'></bdo><ul id='9QZLY'></ul>

                  本文介紹了警告:mysqli_stmt::bind_result():綁定變量的數量與準備好的語句錯誤中的字段數量不匹配的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我有一個 mysql 查詢,我正在將其轉換為 mysqli(準備好的語句),但遇到了一個問題,引發了以下錯誤,

                  I had a mysql query and I was converting it to mysqli(prepared statement) but I ran in to a problem which throws the below error,

                  警告:mysqli_stmt::bind_result():綁定變量的數量與準備好的語句中的字段數量不匹配

                  Warning: mysqli_stmt::bind_result(): Number of bind variables doesn't match number of fields in prepared statement

                  Mysql 代碼

                  $random_name_generated = vpb_generate_random_name().'.jpg'; //Generated name for uploaded files or images
                  
                  if (move_uploaded_file($_FILES['file_to_upload']['tmp_name'], $final_uploads_location)) {
                      $check_empty_field = mysql_query("select * from `vpb_uploads` where `username` = '".mysql_real_escape_string(strip_tags($username))."'  and `firstname` = '".mysql_real_escape_string("")."' and `lastname` = '".mysql_real_escape_string("")."'");
                      if (mysql_num_rows($check_empty_field) < 1) {
                          mysql_query("insert into `vpb_uploads` values('', '".mysql_real_escape_string($username)."', '', '', '".mysql_real_escape_string($random_name_generated)."', '', '', '', '', '".mysql_real_escape_string(date("d-m-Y"))."')");
                  
                          $identity = "image_one";
                      } else {
                          $get_empty_field = mysql_fetch_array($check_empty_field);
                          $image_one = strip_tags($get_empty_field["image_one"]);
                          $image_two = strip_tags($get_empty_field["image_two"]);
                          $image_three = strip_tags($get_empty_field["image_three"]);
                          $image_four = strip_tags($get_empty_field["image_four"]);
                          $image_five = strip_tags($get_empty_field["image_five"]);
                          global $identity;
                  

                  以下是我嘗試過的,即使它不起作用.我已經知道它行不通,但我想在提問之前自己嘗試一下.錯誤來自 $get_empty_field = $stmt->bind_result($stmt);

                  The below is what I tried even though it didn't work. I already knew it won't work but I wanted to try it myself before asking a question. And the error is coming from the $get_empty_field = $stmt->bind_result($stmt);

                  if (move_uploaded_file($_FILES['file_to_upload']['tmp_name'], $final_uploads_location)) {
                      $firstname = '""';
                      $lastname = '""';
                      $stmt = $mysqli->prepare("select * from `vpb_uploads` where `username` = ?  and `firstname` = ? and `lastname` = ?");
                      $stmt->bind_param('sss', $username, $firstname, $lastname);
                      $stmt->execute();
                      $stmt->store_result();
                      if ($stmt->num_rows < 1) {
                          $date = 'date("d-m-Y")';
                          $image_2 = "''";
                          $image_3 = "''";
                          $image_4 = "''";
                          $image_5 = "''";
                          $stmt = $mysqli->prepare("insert into `vpb_uploads` (`username`, `firstname`, `lastname`, `image_one`, `image_two`, `image_three`, `image_four`, `image_five`, `date`) values(?,?,?,?,?,?,?,?,?)");
                          $stmt->bind_param('sssssssss', $username, $firstname, $lastname, $random_name_generated, $image_2, $image_3, $image_4, $image_5, $date);
                          $stmt->execute();
                          $stmt->close();
                  
                          $identity = "image_one";
                      } else {
                          $get_empty_field = $stmt->bind_result($stmt);
                          $image_one = strip_tags($get_empty_field["image_one"]);
                          $image_two = strip_tags($get_empty_field["image_two"]);
                          $image_three = strip_tags($get_empty_field["image_three"]);
                          $image_four = strip_tags($get_empty_field["image_four"]);
                          $image_five = strip_tags($get_empty_field["image_five"]);
                          global $identity;
                  

                  推薦答案

                  你需要改變

                  $get_empty_field = $stmt->bind_result($stmt);
                  

                  $get_empty_field = $stmt->bind_result($field1, $field2, $field3);
                  

                  $fieldx 變量的數量等于所選字段的數量.如果你不知道有多少,使用這個:

                  The number of $fieldx variables being equal to the number of fields that are selected. If you don't know how many there are, use this:

                    // Throw an exception if the result metadata cannot be retrieved
                    if (!$meta = $stmt->result_metadata())
                    {
                      throw new Exception($stmt->error);
                    }
                  
                    // The data array
                    $data = array();
                  
                    // The references array
                    $refs = array();
                  
                    // Iterate over the fields and set a reference
                    while ($name = $meta->fetch_field())
                    {
                      $refs[] =& $data[$name->name];
                    }
                  
                    // Free the metadata result
                    $meta->free_result();
                  
                    // Throw an exception if the result cannot be bound
                    if (!call_user_func_array(array($stmt, 'bind_result'), $refs))
                    {
                      throw new Exception($stmt->error);
                    }
                  

                  然后在獲取后訪問結果,使用 $data['field'];

                  And then you access the result, after fetching, with $data['field'];

                  這篇關于警告:mysqli_stmt::bind_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 中保持其類型?)
                  <i id='iZxhr'><tr id='iZxhr'><dt id='iZxhr'><q id='iZxhr'><span id='iZxhr'><b id='iZxhr'><form id='iZxhr'><ins id='iZxhr'></ins><ul id='iZxhr'></ul><sub id='iZxhr'></sub></form><legend id='iZxhr'></legend><bdo id='iZxhr'><pre id='iZxhr'><center id='iZxhr'></center></pre></bdo></b><th id='iZxhr'></th></span></q></dt></tr></i><div class="2ykswss" id='iZxhr'><tfoot id='iZxhr'></tfoot><dl id='iZxhr'><fieldset id='iZxhr'></fieldset></dl></div>

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

                • <tfoot id='iZxhr'></tfoot>

                      <bdo id='iZxhr'></bdo><ul id='iZxhr'></ul>
                      <legend id='iZxhr'><style id='iZxhr'><dir id='iZxhr'><q id='iZxhr'></q></dir></style></legend>

                          • 主站蜘蛛池模板: 洗地机-全自动/手推式洗地机-扫地车厂家_扬子清洁设备 | 耐高温风管_耐高温软管_食品级软管_吸尘管_钢丝软管_卫生级软管_塑料波纹管-东莞市鑫翔宇软管有限公司 | 上海办公室设计_办公楼,写字楼装修_办公室装修公司-匠御设计 | 磁力抛光机_磁力研磨机_磁力去毛刺机-冠古设备厂家|维修|租赁【官网】 | 复合土工膜厂家|hdpe防渗土工膜|复合防渗土工布|玻璃纤维|双向塑料土工格栅-安徽路建新材料有限公司 | 活性氧化铝|无烟煤滤料|活性氧化铝厂家|锰砂滤料厂家-河南新泰净水材料有限公司 | 地磅-电子地磅维修-电子吊秤-汽车衡-无人值守系统-公路治超-鹰牌衡器 | 石家庄小程序开发_小程序开发公司_APP开发_网站制作-石家庄乘航网络科技有限公司 | 沉降天平_沉降粒度仪_液体比重仪-上海方瑞仪器有限公司 | 谷歌关键词优化-外贸网站优化-Google SEO小语种推广-思亿欧外贸快车 | 电动百叶窗,开窗器,电动遮阳百叶,电动开窗机生产厂家-徐州鑫友工控科技发展有限公司 | 「安徽双凯」自动售货机-无人售货机-成人用品-自动饮料食品零食售货机 | 大倾角皮带机-皮带输送机-螺旋输送机-矿用皮带输送机价格厂家-河南坤威机械 | 深圳天际源广告-形象堆头,企业文化墙,喷绘,门头招牌设计制作专家 | 谷歌关键词优化-外贸网站优化-Google SEO小语种推广-思亿欧外贸快车 | 房屋质量检测-厂房抗震鉴定-玻璃幕墙检测-房屋安全鉴定机构 | 5L旋转蒸发器-20L-50L旋转蒸发器-上海越众仪器设备有限公司 | 贴片电容代理-三星电容-村田电容-风华电容-国巨电容-深圳市昂洋科技有限公司 | 水质监测站_水质在线分析仪_水质自动监测系统_多参数水质在线监测仪_水质传感器-山东万象环境科技有限公司 | 昆山新莱洁净应用材料股份有限公司-卫生级蝶阀,无菌取样阀,不锈钢隔膜阀,换向阀,离心泵 | 厦门ISO认证|厦门ISO9001认证|厦门ISO14001认证|厦门ISO45001认证-艾索咨询专注ISO认证行业 | 自动部分收集器,进口无油隔膜真空泵,SPME固相微萃取头-上海楚定分析仪器有限公司 | 电缆接头_防水接头_电缆防水接头_防水电缆接头_上海闵彬 | 高低温试验房-深圳高低温湿热箱-小型高低温冲击试验箱-爱佩试验设备 | 恒温恒湿箱(药品/保健品/食品/半导体/细菌)-兰贝石(北京)科技有限公司 | CTP磁天平|小电容测量仪|阴阳极极化_双液系沸点测定仪|dsj电渗实验装置-南京桑力电子设备厂 | 防火板_饰面耐火板价格、厂家_品牌认准格林雅 | 南溪在线-南溪招聘找工作、找房子、找对象,南溪综合生活信息门户! | 德国EA可编程直流电源_电子负载,中国台湾固纬直流电源_交流电源-苏州展文电子科技有限公司 | 多米诺-多米诺世界纪录团队-多米诺世界-多米诺团队培训-多米诺公关活动-多米诺创意广告-多米诺大型表演-多米诺专业赛事 | 天津市能谱科技有限公司-专业的红外光谱仪_红外测油仪_紫外测油仪_红外制样附件_傅里叶红外光谱技术生产服务厂商 | 分光色差仪,测色仪,反透射灯箱,爱色丽分光光度仪,美能达色差仪维修_苏州欣美和仪器有限公司 | 杭州标识标牌|文化墙|展厅|导视|户内外广告|发光字|灯箱|铭阳制作公司 - 杭州标识标牌|文化墙|展厅|导视|户内外广告|发光字|灯箱|铭阳制作公司 | 舞台木地板厂家_体育运动木地板_室内篮球馆木地板_实木运动地板厂家_欧氏篮球地板推荐 | SOUNDWELL 编码器|电位器|旋转编码器|可调电位器|编码开关厂家-广东升威电子制品有限公司 | 高压无油空压机_无油水润滑空压机_水润滑无油螺杆空压机_无油空压机厂家-科普柯超滤(广东)节能科技有限公司 | 除甲醛公司-甲醛检测治理-杭州创绿家环保科技有限公司-室内空气净化十大品牌 | 低噪声电流前置放大器-SR570电流前置放大器-深圳市嘉士达精密仪器有限公司 | 冰晶石|碱性嫩黄闪蒸干燥机-有机垃圾烘干设备-草酸钙盘式干燥机-常州市宝康干燥 | 车辆定位管理系统_汽车GPS系统_车载北斗系统 - 朗致物联 | 造价工程师网,考试时间查询,报名入口信息-网站首页 |