Check for database connection, otherwise display message

后端 未结 3 1257
暖寄归人
暖寄归人 2021-02-05 09:33

I would like to check if the website can connect to mySQL. If not, I would like to display an error saying that the user should try to access the page again in a few minutes...<

3条回答
  •  旧巷少年郎
    2021-02-05 09:56

    Try this:

    connect_error) {
       die("Connection failed: " . $conn->connect_error);
    }
      echo "Connected successfully";
    ?>
    

提交回复
热议问题