The mysqli_connect_error() function returns the error description from the last connection if one
exists.
EXAMPLE
RESULT
The result will be displayed here...
Practical use: This function is indispensable during development, as it displays the exact
reason why the connection failed in the browser. Test it at home like this:
If the connection succeeds, the function returns NULL.
The displayed text is usually in English, as returned by the MySQL server.
In production (on a live website), it is best not to display these errors to visitors for security reasons.
We use cookies to ensure a better user experience and website functionality.