본문 바로가기

PHP

PHP PDO 에러 확인

PDO::errorInfo

public PDO::errorInfo(): array

 

 

ex)

 

<?php


$db
->setAttribute(PDO::ATTR_EMULATE_PREPARES,false);
$stmt $db->prepare($sql);
if (!
$stmt) {

    
print_r($db->errorInfo());
}


?>

 

 

 

 

[0] : SQLSTATE error code (a five characters alphanumeric identifier defined in the ANSI SQL standard).

[1] : Driver-specific error code.

[2] : Driver-specific error message.

'PHP' 카테고리의 다른 글

[Laravel] 라라벨 라우팅  (0) 2022.04.28
[Laravel] 라라벨 프로젝트 구조  (0) 2022.04.28