Returns the last error code for the most recently called function:
<?php // Assume database username: root, password: 123456, database: CODERCTO $con = mysqli_connect ( "localhost" , "root" , "123456" , "CODERCTO" ); if ( mysqli_connect_errno ( $con )) { echo "Failed to connect to MySQL: " . mysqli_connect_error (); } // Execute query and check for errors if (! mysqli_query ( $con , "INSERT INTO websites (name) VALUES ('code farmer tutorial')" )){ print_r ( mysqli_error_list ( $con ));} mysqli_close ( $con ); ?>The mysqli_error_list() function returns a list of errors for the most recently called function.
mysqli_error_list( connection ) ;
parameter | describe |
---|---|
connection | Required. Specifies the MySQL connection to use. |
Return value: | Returns a list of errors. Each error is an associative array with errno (error code), error (error text), and sqlstate. |
---|---|
PHP version: | 5.4+ |