-1
一切正常,没有任何地方的单个流,其杀死我:我的SQL/PHP/PDO:奇怪的错误
这是错误:
SQLSTATE [HY000] [14]无法打开数据库文件
这是代码:
<?php
$dsn = 'mysql:host=localhost;dbname=new_db';
$db = new PDO($dsn,'root');
和:
<?php
try {
require_once 'pdo_connect.php';
} catch (Exception $e) {
$error = $e->getMessage();
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Database Connection with PDO</title>
<link href="../../styles/styles.css" rel="stylesheet" type="text/css">
</head>
<body>
<h1>Connecting with PDO</h1>
<?php if ($db) {
echo "<p>Connection successful.</p>";
} elseif (isset($error)) {
echo "<p>$error</p>";
}
?>
</body>
</html>
xamp有什么问题? ,我给每个文件夹任何人permision和根用户az管理员全部
该数据库是否将'new_db'存在吗?你为什么不提交密码? – Reeno 2014-12-07 11:51:15
是的,它没有密码 – Greatone 2014-12-07 11:57:01