try {
$dbh = new PDO("mysql:host=$host", $root, $root_password);
$dbh->exec("INSERT INTO test (col1, col2, col3) VALUES (test1, test1, test1)")
or die(print_r($dbh->errorInfo(), true));
} catch (PDOException $e) {
die("DB ERROR: ". $e->getMessage());
}
我用来打印屏幕上的SQL查询:$sth->debugDumpParams();
但我得到的内部500错误如何打印到查询代码[PDO]
我怎样才能打印查询?
读取日志并找出500错误的原因。 –
'$ sth'似乎并不存在,这真的是你正在使用的?哪里? – jeroen
你好再次@jeroen,我更新了问题 – Editor