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

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

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

      <tfoot id='ttwa0'></tfoot>

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

        PDO bind_param 是未定義的方法

        PDO bind_param is undefined method(PDO bind_param 是未定義的方法)

            <tbody id='aM97x'></tbody>
          <tfoot id='aM97x'></tfoot>

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

        1. <legend id='aM97x'><style id='aM97x'><dir id='aM97x'><q id='aM97x'></q></dir></style></legend>

              • <i id='aM97x'><tr id='aM97x'><dt id='aM97x'><q id='aM97x'><span id='aM97x'><b id='aM97x'><form id='aM97x'><ins id='aM97x'></ins><ul id='aM97x'></ul><sub id='aM97x'></sub></form><legend id='aM97x'></legend><bdo id='aM97x'><pre id='aM97x'><center id='aM97x'></center></pre></bdo></b><th id='aM97x'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='aM97x'><tfoot id='aM97x'></tfoot><dl id='aM97x'><fieldset id='aM97x'></fieldset></dl></div>
                  <bdo id='aM97x'></bdo><ul id='aM97x'></ul>
                • 本文介紹了PDO bind_param 是未定義的方法的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  我正在遠(yuǎn)離 mysql 和 mysqli,因為 stackoverflow 上的許多用戶一直在說好話.

                  I'm moving away from mysql and mysqli as many users on stackoverflow are constantly saying good things about it.

                  我制作了一個數(shù)據(jù)庫類并對此進(jìn)行了測試,這可以很好地連接到數(shù)據(jù)庫.我試圖更新我準(zhǔn)備好的語句以匹配但是我在陌生的領(lǐng)域并最終收到以下錯誤:

                  I've made a database class and have tested this, this connects fine to the database. I've tried to update my prepared statements to match however I am in unfamiliar territory and have ended up getting the following error:

                  Fatal error: Call to undefined method PDOStatement::bind_param() in E:xampphtdocsimanageinsert.php on line 50

                  這反映了這一行:

                  $stmt->bind_param("s", $_POST['email']);

                  另外,關(guān)于這個,我得到了數(shù)據(jù)庫連接成功和關(guān)閉語句返回給我以及致命錯誤,例如:

                  Also in regards to this I am getting the database connection success and close statements returned to me as well as the fatal error e.g:

                  連接數(shù)據(jù)庫成功!連接數(shù)據(jù)庫成功!斷開數(shù)據(jù)庫連接成功!

                  我將解釋我想要實現(xiàn)的目標(biāo):

                  I'll explain what I am trying to achieve:

                  • 在注冊用戶之前檢查數(shù)據(jù)庫中是否存在電子郵件
                  • 如果是,請告訴用戶此電子郵件存在
                  • 如果不匹配,則將用戶插入到用戶表中并加密密碼

                  相關(guān)代碼如下,如果有人能給我一些指導(dǎo),我將不勝感激.

                  The relevant code is below and would appreciate if anyone could give me some guidance on this.

                  index.php

                          <form id="loginForm" method="POST" action="class.Login.php">
                          <input type="text" id="email" name="email" placeholder="E-mail">
                          <input type="password" id="password" name="password" placeholder="Password" class="showpassword"> 
                          <input type="submit" name="submit" value="Log in"></form>
                  

                  插入.php

                  public function insert() {
                  
                                      $stmt = $this->pdo->prepare("SELECT COUNT(*) FROM users WHERE email=?");
                                      $stmt->bind_param("s", $_POST['email']);
                                      $stmt->execute();
                                      $stmt->bind_result($email_count);
                                      $stmt->fetch();//fecth
                                      $stmt->close();     
                  
                                      if ($email_count > 0) {
                                          echo "email exisits! click here to try <a href='register'>again</a>";
                                          } else {
                                              //escape the POST data for added protection
                                              $username = isset($_POST['username']) ? $_POST['username'] : null;
                                              $cryptedPassword = crypt($_POST['password']);
                                              $password = $cryptedPassword;
                                              $name = isset($_POST['name']) ? $_POST['name'] : null;
                                              $email = isset($_POST['email']) ? $_POST['email'] : null;
                                              $stmta = $this->pdo->prepare("INSERT INTO users (username, password, name, email) VALUES (?, ?, ?, ?)");
                                              //var_dump($this->pdo->error);
                                              $stmta->bind_param('ssss', $username, $password, $name, $email); // bind strings to the paramater
                  
                                                  /* execute prepared statement */
                                                  $stmta->execute();
                                                  printf("%d Row inserted.
                  ", $stmta->affected_rows);
                                                  /* close statement and connection */
                                                  $stmta->close();
                                  } // end email_count and insert to table
                              } // end function
                  

                  connect/class.Database.php

                  connect/class.Database.php

                  <?php
                  
                  // Database connection PDO
                  
                  class Database {
                  
                      public function __construct() {
                          // Connection information
                          $host   = 'localhost';
                          $dbname = 'imanage';
                          $user   = 'root';
                          $pass   = '';
                  
                          // Attempt DB connection
                          try
                          {
                              $this->pdo = new PDO("mysql:host=$host;dbname=$dbname", $user, $pass);
                              $this->pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
                              echo 'Successfully connected to the database!';
                          }
                          catch(PDOException $e)
                          {
                              echo $e->getMessage();
                          }
                  
                      }
                  
                       public function __destruct()
                      {
                          // Disconnect from DB
                          $this->pdo = null;
                          echo 'Successfully disconnected from the database!';
                      }
                  
                  
                  }
                  
                  $run = new Database();
                  ?>
                  

                  推薦答案

                  一些 PDO 示例

                  綁定參數(shù)示例

                  $stmt = $this->pdo->prepare("SELECT COUNT(*) FROM users WHERE email=:email");
                  $stmt->bindParam(":email", $_POST['email']);
                  $stmt->execute();
                  $stmt->fetch(PDO::FETCH_ASSOC);
                  

                  數(shù)組示例

                  $data = array($username, $password, $name, $email); 
                  $stmta = $this->pdo->prepare("INSERT INTO users (username, password, name, email) VALUES (?, ?, ?, ?)");
                  $stmta->execute($data);
                  

                  PDO教程

                  這篇關(guān)于PDO bind_param 是未定義的方法的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

                  相關(guān)文檔推薦

                  Deadlock exception code for PHP, MySQL PDOException?(PHP、MySQL PDOException 的死鎖異常代碼?)
                  PHP PDO MySQL scrollable cursor doesn#39;t work(PHP PDO MySQL 可滾動游標(biāo)不起作用)
                  PHP PDO ODBC connection(PHP PDO ODBC 連接)
                  Using PDO::FETCH_CLASS with Magic Methods(使用 PDO::FETCH_CLASS 和魔術(shù)方法)
                  php pdo get only one value from mysql; value that equals to variable(php pdo 只從 mysql 獲取一個值;等于變量的值)
                  MSSQL PDO could not find driver(MSSQL PDO 找不到驅(qū)動程序)

                  1. <tfoot id='OL0ay'></tfoot>
                      <tbody id='OL0ay'></tbody>

                    1. <legend id='OL0ay'><style id='OL0ay'><dir id='OL0ay'><q id='OL0ay'></q></dir></style></legend>
                        • <bdo id='OL0ay'></bdo><ul id='OL0ay'></ul>
                        • <small id='OL0ay'></small><noframes id='OL0ay'>

                          <i id='OL0ay'><tr id='OL0ay'><dt id='OL0ay'><q id='OL0ay'><span id='OL0ay'><b id='OL0ay'><form id='OL0ay'><ins id='OL0ay'></ins><ul id='OL0ay'></ul><sub id='OL0ay'></sub></form><legend id='OL0ay'></legend><bdo id='OL0ay'><pre id='OL0ay'><center id='OL0ay'></center></pre></bdo></b><th id='OL0ay'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='OL0ay'><tfoot id='OL0ay'></tfoot><dl id='OL0ay'><fieldset id='OL0ay'></fieldset></dl></div>
                          • 主站蜘蛛池模板: 久久精品a | 夜夜艹 | 久久久www成人免费精品张筱雨 | 日日干天天操 | 久久久片 | 亚洲久久| 综合色导航 | 婷婷五月色综合香五月 | 在线三级电影 | 欧美亚洲视频 | 亚洲精品久久久久久国产精华液 | 国产精品视频久久久久 | av黄色片 | www.色综合 | www.xxxx欧美| 波多野结衣一区二区 | 午夜私人影院 | 中文字字幕一区二区三区四区五区 | 亚洲国产精品一区二区第一页 | 国产精品久久免费观看 | 日韩精品在线免费观看视频 | 久久久久久中文字幕 | 国产色片| 日韩 欧美 二区 | 久草精品视频 | 国产精品免费一区二区 | 五月婷婷丁香婷婷 | 午夜码电影 | 国产成人高清视频 | 精品一区二区三区在线播放 | 欧美性精品| 福利电影在线 | 一区二区三区在线 | 欧 | 99色综合 | 美女黄色在线观看 | 天天影视亚洲综合网 | 日韩欧美在线视频 | 国产成人免费视频网站高清观看视频 | wwwsihu| 欧美专区在线 | 美女在线观看国产 |