Query: mysqli_error_list
OS: php
Section: 3
Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar
MYSQLI_ERROR_LIST(3) 1 MYSQLI_ERROR_LIST(3) mysqli::$error_list - Returns a list of errors from the last command executed Object oriented styleSYNOPSISarray$mysqli->error_list ()DESCRIPTIONProcedural style array mysqli_error_list (mysqli $link) Returns a array of errors for the most recent MySQLi function call that can succeed or fail.PARAMETERSo $ link -Procedural style only: A link identifier returned by mysqli_connect(3) or mysqli_init(3)RETURN VALUESA list of errors, each as an associative array containing the errno, error, and sqlstate.EXAMPLESExample #1 $mysqli->error_list example Object oriented style <?php $mysqli = new mysqli("localhost", "nobody", ""); /* check connection */ if (mysqli_connect_errno()) { printf("Connect failed: %s ", mysqli_connect_error()); exit(); } if (!$mysqli->query("SET a=1")) { print_r($mysqli->error_list); } /* close connection */ $mysqli->close(); ?> Procedural style <?php $link = mysqli_connect("localhost", "my_user", "my_password", "world"); /* check connection */ if (mysqli_connect_errno()) { printf("Connect failed: %s ", mysqli_connect_error()); exit(); } if (!mysqli_query($link, "SET a=1")) { print_r(mysqli_error_list($link)); } /* close connection */ mysqli_close($link); ?> The above examples will output: Array ( [0] => Array ( [errno] => 1193 [sqlstate] => HY000 [error] => Unknown system variable 'a' ) )SEE ALSOmysqli_connect_errno(3), mysqli_connect_error(3), mysqli_error(3), mysqli_sqlstate(3). PHP Documentation Group MYSQLI_ERROR_LIST(3)