Skip to content
Advertisement

How to redirect PHP page on MySQL database connection failure

Using MySQLi connection method I am trying to redirect page instead of printing out the error message

JavaScript

trying to test this out I change the localhost to localhostszzz but I am getting error message of

Warning: mysqli::__construct(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /../../page.php on line 8

Instead of re-directing to http://www.example.com/, how can I fix this?

Advertisement

Answer

OK, This is what I was looking for and is working for me mow

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement