PHP mysqli_connect_errno() Function

Definition

The mysqli_connect_errno() function returns the error code from the last connection error.

Syntax

PHP mysqli_connect_errno() Function has the following syntax.

mysqli_connect_errno();

Return

An error code value for the last call to mysqli_connect(), if it failed. zero means no error occurred.

Example

Get the error code from the last connection error


<?php/*from   w  w  w . jav  a  2  s  . c  o m*/
$con=mysqli_connect("localhost","wrong_user","my_wrongPassword","my_WrongDatabase");
// Check connection
if (!$con){
  die("Connection error: " . mysqli_connect_errno());
}
?>




















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