-1

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!

daCoder848
  • 32
  • 4

1 Answers1

-2

You need to use mysqli_connect_error($link) or $link->connect_error.

if ($link->connect_error) {
  die("MySQL connection error: ".$link->connect_error);
}
Maytha8
  • 846
  • 1
  • 8
  • 26