I'm working on a project that involves accessing the MySQL database. I know how to make a connection to the database using mysqli
, but I don't know how to check the connection.
Thanks!
I'm working on a project that involves accessing the MySQL database. I know how to make a connection to the database using mysqli
, but I don't know how to check the connection.
Thanks!
You need to use mysqli_connect_error($link)
or $link->connect_error
.
if ($link->connect_error) {
die("MySQL connection error: ".$link->connect_error);
}