当我尝试从文本框插入表格时,出现此错误:
致命错误:未捕获的异常' PDOException'有消息'无法找到驱动程序'在第15行的C:\ wamp \ www \ php \ login \ data \ DB \ Users \ UsersTbl.php中(!)PDOException:在C:\ wamp \ www \ php \ login \ data \ DB \ Users中找不到驱动程序第15行的UsersTbl.php
我试过检查php.ini:
extension_dir = "c:/wamp/bin/php/php5.5.12/ext/"
;extension=php_pdo_firebird.dll
extension=php_pdo_mysql.dll
;extension=php_pdo_oci.dll
;extension=php_pdo_odbc.dll
;extension=php_pdo_pgsql.dll
extension=php_pdo_sqlite.dll
;extension=php_pgsql.dll
extension=php_shmop.dll
PHP文件:
<?php
class usersTbl {
private $colNames;
public function __construct() {
$this->colNames = array("id", "fname", "lname", "email", "password", "rpassword");
}
public function insert(array $data) {
$pdo = new PDO("mysql:host=" . "localhost" . ";dbname=" . "test" . ";charset= utf8", "root", "", array(PDO::ATTR_PERSISTENT => true));
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$sql = " INSERT INTO persons (fname,lname,email,password,rpassword) VALUES(?,?,?,?,?)";
$stmt = $pdo->prepare($sql);
$stmt->execute(array($data['fname'],$data['lname'],$data['email'], sha1($data['password']),$data['rpassword']));
}
}
PHP版本:5.5.12
有什么想法吗?