Home > Backend Development > PHP Tutorial > pdo连接有关问题

pdo连接有关问题

WBOY
Release: 2016-06-13 10:17:32
Original
878 people have browsed it

pdo连接问题?
 $db = new PDO('mysql:host=localhost;dbname=epet','root','');
 try {
  foreach($db->query('select * from petinfo') as $row){ 
  //查询数据库
  print_r($row);
  }
  $db=null;
  //关闭数据库连接
 } catch (PDOException $e) {
  echo $e->getMessage();
 }
?>

始终报$db = new PDO('mysql:host=localhost;dbname=epet','root','');出错,
我的php.ini中的
extension=php_pdo.dll
;extension=php_pdo_firebird.dll
;extension=php_pdo_mssql.dll
extension=php_pdo_mysql.dll
;extension=php_pdo_oci.dll
;extension=php_pdo_oci8.dll
;extension=php_pdo_odbc.dll
;extension=php_pdo_pgsql.dll
;extension=php_pdo_sqlite.dll
是好的 怎么连接不上呢?

------解决方案--------------------
什么错误?function undefined?

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template