PHP PDO内部服务器错误

时间:2014-03-10 02:24:17

标签: php mysql pdo

我正在尝试使用PDO(MySQL)插入表格

连接文件:

try {

$con = new PDO('mysql:host=sadf;dbname=sadf','sadfsdaf1','asdfsdaf');
$con -> setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

}
catch(PDOException $e) {
echo("<h2>Error: Unable to connect to database </h2>");
echo $e->getMessage();

//Insert into errors database
}

代码:

$sql = "INSERT INTO domains (team_id,domain_id,name,description,date,user_id) VALUES (:team,'',:name,:desc,NOW(),:user)";
$query = $con->prepare($sql);
$query->bindParam(':team', $team_id);
$query->bindParam(':name', $name);
$query->bindParam(':desc', $description);
$query->bindParam(':user', $user_id);
$query->execute();

我一直收到错误,页面的其余部分都没有加载。我收到内部服务器错误。

0 个答案:

没有答案