mysqli::$error_list
(mysqli_error_list) Returns the error list of the previous command executed
error_list
/ mysqli_error_list()
function returns the error list (if any) of the last executed command.
Returns the error list of the last command executed (if any):
<?php $mysqli = new mysqli ( "localhost" , "my_user" , "my_password" , "my_db" ) ; if ( $mysqli -> connect_errno ) { echo "Failed to connect to MySQL: " . $mysqli -> connect_error ; exit ( ) ; } // Execute the query and check for errors if ( ! $mysqli -> query ( "INSERT INTO Persons (FirstName) VALUES ('Glenn')" ) ) { print_r ( $mysqli -> error_list ) ; } $mysqli -> close ( ) ; ?>
Returns the error list of the last command executed (if any):
<?php $con = mysqli_connect ( "localhost" , "my_user" , "my_password" , "my_db" ) ; if ( mysqli_connect_errno ( ) ) { echo "Failed to connect to MySQL: " . mysqli_connect_error ( ) ; exit ( ) ; } // Execute the query and check for errors if ( ! mysqli_query ( $con , "INSERT INTO Persons (FirstName) VALUES ('Glenn')" ) ) { print_r ( mysqli_error_list ( $con ) ) ; } mysqli_close ( $con ) ; ?>