You are here : phpmysqlimysqli_errno

mysqli_errno() - mysqli

The mysqli_errno() function returns the last error code for the most recent function call, if any.


Syntax

mysqli_errno(connection);


Example

<?php
$con=mysqli_connect("localhost","my_user","my_password","my_db");
// Check connection
if (mysqli_connect_errno())
  {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
  }

// Perform a query, check for error
if (!mysqli_query($con,"INSERT INTO Persons (FirstName) VALUES ('Glenn')"))
  {
  echo("Errorcode: " . mysqli_errno($con));
  }

mysqli_close($con);
?>


Output / Return Value


Limitations


Alternatives / See Also


Reference