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

<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="qwawimqqmiuu" 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():綁定變量的數(shù)量與準備

        Warning: mysqli_stmt::bind_result(): Number of bind variables doesn#39;t match number of fields in prepared statement error(警告:mysqli_stmt::bind_result():綁定變量的數(shù)量與準備好的語句錯誤中的字段數(shù)量不匹配) - 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="qwawimqqmiuu" 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():綁定變量的數(shù)量與準備好的語句錯誤中的字段數(shù)量不匹配的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

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

                  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():綁定變量的數(shù)量與準備好的語句中的字段數(shù)量不匹配

                  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;
                  

                  以下是我嘗試過的,即使它不起作用.我已經(jīng)知道它行不通,但我想在提問之前自己嘗試一下.錯誤來自 $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 變量的數(shù)量等于所選字段的數(shù)量.如果你不知道有多少,使用這個:

                  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():綁定變量的數(shù)量與準備好的語句錯誤中的字段數(shù)量不匹配的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

                  相關文檔推薦

                  store_result() and get_result() in mysql returns false(mysql 中的 store_result() 和 get_result() 返回 false)
                  Call to undefined function mysqli_result::num_rows()(調用未定義的函數(shù) 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="qwawimqqmiuu" 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>

                          • 主站蜘蛛池模板: 日韩福利电影 | 亚洲高清视频在线 | 午夜影院中文字幕 | 亚洲色欲色欲www | 视频一区二区国产 | 99久久久无码国产精品 | 热re99久久精品国99热观看 | 欧美11一13sex性hd | 亚洲看片网站 | 99精品免费久久久久久日本 | 日本精品一区二区三区在线观看视频 | 毛片a级 | 一级在线毛片 | 国产国拍亚洲精品av | 久久久久久免费观看 | 一区二区视频 | 国产日韩精品视频 | 国产精品久久国产精品 | 天天插天天搞 | 国产乱码一区 | 国产欧美一区二区三区久久手机版 | 精品久久久久久久久久久久 | 日本一本视频 | 国产视频久久 | 国产精品久久久久婷婷二区次 | 亚洲在线视频 | 美女黄色在线观看 | 麻豆hd| 在线观看视频一区 | 久草电影网 | 久久精品天堂 | 免费黄色在线观看 | 一区二区三区影院 | 免费观看日韩av | 欧美性猛交一区二区三区精品 | 免费在线一区二区 | 日韩欧美亚洲 | 97色在线观看免费视频 | 久久精品99国产精品日本 | 中文字幕一区二区三区在线乱码 | 国产97久久 |