PHP mysqli_error_list() Function
In this chapter you will learn:
- Definition for PHP mysqli_error_list() Function
- Syntax for PHP mysqli_error_list() Function
- Parameter for PHP mysqli_error_list() Function
- Return for PHP mysqli_error_list() Function
- Example - returns a list of errors for the most recent function call
Definition
The mysqli_errno() function returns a list of errors for the most recent function call.
Syntax
PHP mysqli_error_list() Function has the following syntax.
mysqli_error_list(connection);
Parameter
Parameter | is Required | Description |
---|---|---|
connection | Required. | MySQL connection |
Return
A list of errors, each as an associative array containing the errno, error, and sqlstate.
Example
<?php// ja v a 2 s . c o m
$con=mysqli_connect("localhost","my_user","my_password","my_db");
// Check connection
if (mysqli_connect_errno($con)){
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
// Perform a query, check for error
if (!mysqli_query($con,"INSERT INTO Persons (FirstName) VALUES ('Jack')")){
print_r(mysqli_error_list($con));
}
mysqli_close($con);
?>
Next chapter...
What you will learn in the next chapter:
- Definition for PHP mysqli_fetch_all() Function
- Syntax for PHP mysqli_fetch_all() Function
- Parameter for PHP mysqli_fetch_all() Function
- Return for PHP mysqli_fetch_all() Function
- Example - fetches all rows and return the result-set as an associative array
Home » PHP Tutorial » PHP MySQLi Functions