Give an error when connection dies

This commit is contained in:
Michał Gdula 2022-09-14 16:43:06 +00:00
parent cb838ad53b
commit dec15d7b63
4 changed files with 50 additions and 27 deletions

View file

@ -1,21 +1,18 @@
<?php
/*
Connect to database
Connect to database
Dunno what else to put here lol
Dunno what else to put here lol
*/
$conn_ip = "192.168.0.79:3306";
$conn_username = "uwu";
$conn_password = "fennec621";
$conn_database = "gallery";
try {
$conn_ip = "192.168.0.79:3306";
$conn_username = "uwu";
$conn_password = "fennec621";
$conn_database = "gallery";
$conn = mysqli_connect($conn_ip, $conn_username, $conn_password , $conn_database);
if ($conn->connect_error) {
?>
<script>
sniffleAdd('Error','Could not make a connection to the server, please try again later','var(--red)','assets/icons/warning.svg');
</script>
<?php
$conn = @mysqli_connect($conn_ip, $conn_username, $conn_password , $conn_database);
} catch (Exception $e) {
header("location: error.php?e=conn");
}
session_start();