How to check if a MySQL database connection is successful in PHP?
If you have mysqli extension installed with PHP and you use it to perform database operations, after you have tried to connect to MySQL by: $conn = new mysqli(‘localhost’, ‘db_user’, ‘db_pwd’, ‘db_name’); You can then check if the connection is successful by: if ($conn -> connect_errno) { // failure } else { // success } …
How to check if a MySQL database connection is successful in PHP? Read More »