mirror of
https://github.com/Alvin-Zilverstand/pokedex.git
synced 2026-03-06 21:29:57 +01:00
Improve error handling in API and enhance JSON parsing in script.js
This commit is contained in:
@@ -10,7 +10,7 @@ $conn = new mysqli($servername, $username, $password, $dbname);
|
||||
// Check connection
|
||||
if ($conn->connect_error) {
|
||||
error_log("Connection failed: " . $conn->connect_error);
|
||||
die("Connection failed: " . $conn->connect_error);
|
||||
die(json_encode(['error' => "Connection failed: " . $conn->connect_error]));
|
||||
}
|
||||
|
||||
header('Content-Type: application/json');
|
||||
|
||||
Reference in New Issue
Block a user