Por que essa exceção DOP não está sendo capturada? [fechadas
Eu tenho um INSERT envolvido em uma tentativa / captura, mas uma tabela ausente não está sendo capturada e o PHP está com erro em '$ dbh-> prepare'. Eu configurei o 'PDO :: ATTR_ERRMODE' e o valor ecoou no navegador antes de '$ dbh-> prepare' ser 2.
Se a tabela existir, o INSERT funcionará como eu esperava. Eu só descobri que havia um problema durante o teste quando deixei de lado a tabela e executei o códig
O que eu esqueci?
Desde já, obrigad
PHP Erro fatal: exceção não capturada 'PDOException' com a mensagem 'SQLSTATE [HY000]: Erro geral: 1 não existe essa tabela: submit_info' em C: \ etc \ httpd \ htdocs \ sqlite_data \ gather.php: 309
if($our->db['save']) {
try {
echo $dbh->getAttribute(constant('PDO::ATTR_ERRMODE'));
$sth = $dbh->prepare(
"INSERT INTO submit_info( post_time, post_completed, post_size , script_name, user_agent )" .
" VALUES ( datetime(:request_time, 'unixepoch'), datetime(:current_time, 'unixepoch'), :content_length, :script_filename, :user_agent );"
);
$sth->bindValue(':request_time', (@$_SERVER['REQUEST_TIME'] + 0), PDO::PARAM_INT);
$sth->bindValue(':current_time', time(), PDO::PARAM_INT);
$sth->bindValue(':content_length', (@$_SERVER['CONTENT_LENGTH'] + 0), PDO::PARAM_INT);
$sth->bindValue(':script_filename', @$_SERVER['SCRIPT_FILENAME'], PDO::PARAM_STR);
$sth->bindValue(':user_agent', (@$_SERVER['HTTP_USER_AGENT'] . ''), PDO::PARAM_STR);
$sth->execute();
$our->db['submit_id'] = $dbh->lastInsertId();
} catch (PDOExeption $e) {
echo "There was an error!"; # try writing something to the browser temporarily
errors("Error writing page load information to database: " . $e->getMessage());
$our->db['save'] = FALSE;
}
}