mysqli::$connect_error
(mysqli_connect_error) Returns the string description of the last connection error
connect_error
/ mysqli_connect_error()
function returns the error description of the last connection error (if any).
Returns the error description of the last connection error (if any):
<?php $mysqli = new mysqli ( "localhost" , "my_user" , "my_password" , "my_db" ) ; // Check the connection if ( $mysqli -> connect_errno ) { echo "Failed to connect to MySQL: " . $mysqli -> connect_error ; exit ( ) ; } ?>
Returns the error description of the last connection error (if any):
<?php $con = mysqli_connect ( "localhost" , "my_user" , "my_password" , "my_db" ) ; // Check the connection if ( mysqli_connect_errno ( ) ) { echo "Failed to connect to MySQL: " . mysqli_connect_error ( ) ; exit ( ) ; } ?>