Home  >  Article  >  Backend Development  >  pdo连接有关问题

pdo连接有关问题

WBOY
WBOYOriginal
2016-06-13 10:17:32851browse

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?

Statement:
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