PHP mysqli_connect_error() Function
In this chapter you will learn:
- Definition for PHP mysqli_connect_error() Function
- Syntax for PHP mysqli_connect_error() Function
- Return for PHP mysqli_connect_error() Function
- Example - Get the error description from the last connection error
Definition
The mysqli_connect_error() function returns the error description from the last connection error.
Syntax
PHP mysqli_connect_error() Function has the following syntax.
mysqli_connect_error();
Return
A string that describes the error. NULL is returned if no error occurred.
Example
Get the error description from the last connection error
<?php//from j a va2 s . c o m
$con=mysqli_connect("localhost","wrong_user","my_password","my_db");
if (!$con){
die("Connection error: " . mysqli_connect_error());
}
?>
Next chapter...
What you will learn in the next chapter:
- Definition for PHP mysqli_data_seek() Function
- Syntax for PHP mysqli_data_seek() Function
- Parameter for PHP mysqli_data_seek() Function
- Return for PHP mysqli_data_seek() Function
- Example - points to row number 15 in the result set
Home » PHP Tutorial » PHP MySQLi Functions