Latest web development tutorials

PHP mysqli_error_list () function

PHP MySQLi Reference Manual PHP MySQLi Reference Manual

Examples

Function returns the most recent call last error code:

<? php
// Assumes that the database username: root, password: 123456, database: w3big
$ con = mysqli_connect ( "localhost" , "root", "123456", "w3big");
if (mysqli_connect_errno ($ con))
{
echo "MySQL connection failed:" mysqli_connect_error ();.
}

// Execute the query, check for errors
if (! mysqli_query ($ con, "INSERT INTO websites (name) VALUES ( ' tutorial')"))
{
print_r (mysqli_error_list ($ con)) ;
}

mysqli_close ($ con);
?>

Definition and Usage

mysqli_error_list () function returns the error list recently called function.


grammar

mysqli_error_list( connection ) ;

参数 描述
connection 必需。规定要使用的 MySQL 连接。

technical details

return value: Returns list of errors. Each error is an errno (error code), error (error text) and associated with an array sqlstate.
PHP version: 5.4+


PHP MySQLi Reference Manual PHP MySQLi Reference Manual