PHP mysqli_connect_error() Function

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// w  w w  . j  av a2 s . c om
$con=mysqli_connect("localhost","wrong_user","my_password","my_db");

if (!$con){
  die("Connection error: " . mysqli_connect_error());
}
?>




















Home »
  PHP Tutorial »
    Function reference »




PHP Array Functions
PHP Calendar Functions
PHP Class Functions
PHP Data Type Functions
PHP Date Functions
PHP File Functions
PHP Image Functions
PHP Math Functions
PHP MySQLi Functions
PHP SimpleXML Functions
PHP String Functions
PHP XML Functions
PHP Zip Functions