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

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

<tfoot id='Hpt6N'></tfoot>

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

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

      1. 警告:PDOStatement::execute():SQLSTATE[HY093]:無效的參數號

        Warning: PDOStatement::execute(): SQLSTATE[HY093]: Invalid parameter number: parameter was not defined in...filetext(警告:PDOStatement::execute():SQLSTATE[HY093]:無效的參數號:參數未在...文件文本中定義) - IT屋-程序員軟件
          <tbody id='2gaC9'></tbody>
        <legend id='2gaC9'><style id='2gaC9'><dir id='2gaC9'><q id='2gaC9'></q></dir></style></legend>

        • <small id='2gaC9'></small><noframes id='2gaC9'>

                <tfoot id='2gaC9'></tfoot>
                  <bdo id='2gaC9'></bdo><ul id='2gaC9'></ul>
                  <i id='2gaC9'><tr id='2gaC9'><dt id='2gaC9'><q id='2gaC9'><span id='2gaC9'><b id='2gaC9'><form id='2gaC9'><ins id='2gaC9'></ins><ul id='2gaC9'></ul><sub id='2gaC9'></sub></form><legend id='2gaC9'></legend><bdo id='2gaC9'><pre id='2gaC9'><center id='2gaC9'></center></pre></bdo></b><th id='2gaC9'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='2gaC9'><tfoot id='2gaC9'></tfoot><dl id='2gaC9'><fieldset id='2gaC9'></fieldset></dl></div>
                  本文介紹了警告:PDOStatement::execute():SQLSTATE[HY093]:無效的參數號:參數未在...文件文本中定義的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  $fields 是一個數組,在打印后得到如下值:

                  $fields is an array that after printing gets values like:

                  Array ( [first_name] => Nisse [last_name] => Example [ssn] => 198306205053 [address] =>           Stockholm, Sverige [phone_number] => 54654987321546 [latitude] => 55.717089999999999 [longitude] => 13.235379 )
                  

                  我像這樣從我的數據類調用更新函數:

                  I call the update function from my dataclass like so:

                  DataManager::update_user($fields, $user_data['id'];
                  

                  但我收到錯誤:

                  警告:PDOStatement::execute():SQLSTATE[HY093]:無效的參數號:參數未在...文件文本中定義

                  Warning: PDOStatement::execute(): SQLSTATE[HY093]: Invalid parameter number: parameter was not defined in...filetext

                  我已經檢查了其他幾個類似的線程,但我想我在這里遺漏了一些基本概念,因為我仍然找不到答案.據我所知,我的數組中有 7 個 ? 和 7 個項目,如果我定義了所有值,我可以在 SQL 工作臺中完美地運行它,即:

                  I have checked several other similar threads but I guess I′m missing some basic concept here because I still can′t find the answer. There are 7 ?'s and 7 items in my array as far as I can see, and if I define all the values I can run it perfectly in SQL workbench, i.e.:

                  UPDATE users SET first_name = 'Kalle', last_name = 'Anka', ssn = 242345234, address = 'Stockholm', phone_number = 53423434, latitude = 17.189889231223423423424324234, longitude = 109.234234 WHERE id = 4
                  

                  我已經嘗試了 PDO 準備好的語句,其中 $user_id 設置為特定值并且沒有緯度/經度參數.

                  I have tried the PDO prepared statement both with the $user_id set to a specific value and also without the latitude/longitude parameters.

                  如果我忘記了任何重要信息,請指出,我會得到.address 是 varchar 并且 lat/long 是 DB 中的浮點數.使用 MYSQL.

                  If I have forgotten any critical information just point it out and I will get it. address is varchar and lat/long are floats in the DB btw. Using MYSQL.

                  函數如下:

                  public static function update_user($fields, $user_id)
                  {
                      $db = self::_connect();
                  
                      $st = $db->prepare("UPDATE users SET first_name = ?, last_name = ?, ssn = ?, address = ?, phone_number = ?, latitude = ?, longitude = ? WHERE id = '{$user_id}'");
                      $st->execute($fields);
                  
                      return ($st->rowCount()) ? true : false;
                  }
                  

                  推薦答案

                  如果使用位置參數,則傳遞給 execute() 的參數數組必須是序數數組.同樣,如果使用命名參數,則數組必須是關聯數組.

                  If you use positional parameters, the array of parameters you pass to execute() must be an ordinal array. Likewise, if you use named parameters, the array must be an associative array.

                  這是確認行為的測試:

                  $stmt = $db->prepare("SELECT ?, ? ,?");
                  
                  $params = array( 'a', 'b', 'c' );
                  // OK
                  if ($stmt->execute($params)) {
                    print_r($stmt->fetchAll());
                  }
                  
                  $params = array( 'A'=>'abc', 'B'=>'def', 'C'=>'ghi' );
                  // ERROR!
                  if ($stmt->execute($params)) {
                    print_r($stmt->fetchAll());
                  }
                  
                  $stmt = $db->prepare("SELECT :A, :B, :C");
                  
                  $params = array( 'a', 'b', 'c' );
                  // ERROR!
                  if ($stmt->execute($params)) {
                    print_r($stmt->fetchAll());
                  }
                  
                  $params = array( 'A'=>'abc', 'B'=>'def', 'C'=>'ghi' );
                  // OK
                  if ($stmt->execute($params)) {
                    print_r($stmt->fetchAll());
                  }
                  

                  請注意,在當前版本的 PHP 中,關聯數組鍵不必: 為前綴作為@prodigitalson 注釋.: 前綴在舊版 PHP 中的數組鍵中是必需的.

                  Note that in current versions of PHP, the associative array keys don't have to be prefixed with : as @prodigitalson comments. The : prefix used to be required in array keys in older versions of PHP.

                  還值得一提的是,當我嘗試在單個查詢中混合位置參數和命名參數時,我遇到了錯誤和不可預測的行為.您可以在應用的不同查詢中使用任一樣式,但為給定查詢選擇一種樣式或另一種樣式.

                  It's also worth mentioning that I've encountered bugs and unpredictable behavior when I tried to mix positional parameters and named parameters in a single query. You can use either style in different queries in your app, but chose one style or another for a given query.

                  這篇關于警告:PDOStatement::execute():SQLSTATE[HY093]:無效的參數號:參數未在...文件文本中定義的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

                  相關文檔推薦

                  MySQLi prepared statement amp; foreach loop(MySQLi準備好的語句amp;foreach 循環)
                  Is mysqli_insert_id() gets record from whole server or from same user?(mysqli_insert_id() 是從整個服務器還是從同一用戶獲取記錄?)
                  PHP MySQLi doesn#39;t recognize login info(PHP MySQLi 無法識別登錄信息)
                  mysqli_select_db() expects exactly 2 parameters(mysqli_select_db() 需要 2 個參數)
                  Php mysql pdo query: fill up variable with query result(Php mysql pdo 查詢:用查詢結果填充變量)
                  MySQLI 28000/1045 Access denied for user #39;root#39;@#39;localhost#39;(MySQLI 28000/1045 用戶“root@“localhost的訪問被拒絕)

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

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

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

                            主站蜘蛛池模板: 91精品国模一区二区三区 | 国产精品99精品久久免费 | 91久久| 国产成人亚洲精品自产在线 | 国产精品久久777777 | 一区二区福利视频 | 欧美精品久久久久久久久老牛影院 | 久久久久国产 | 国产成人99久久亚洲综合精品 | 国产精品国产成人国产三级 | 久久视频精品 | 国产精品久久久久久238 | 日本激情视频网 | 一区二区三区四区不卡 | 久久国产精品免费 | 国产大片黄色 | 国产乱码精品一品二品 | 免费观看成人鲁鲁鲁鲁鲁视频 | 奇米影视首页 | 精品国产欧美一区二区 | 日本又色又爽又黄又高潮 | 一区二区在线不卡 | 日韩精品免费视频 | 久久久久国产精品午夜一区 | 一区二区三区视频在线免费观看 | 久久精品无码一区二区三区 | 一级欧美| 国产乱码精品一区二区三区忘忧草 | 夜夜摸天天操 | 日产精品久久久一区二区福利 | 中文字幕成人av | 韩国欧洲一级毛片 | 国产成人精品一区二区三区视频 | 一区二区成人 | 欧美精品一区三区 | 美女国产精品 | 香蕉一区二区 | 久草福利 | 91在线资源| 欧美三级电影在线播放 | 久久成人免费 |