anime-backlog-list/php/db_connect.example.php
2025-01-07 14:05:02 +05:00

20 lines
559 B
PHP

<?php
session_start();
error_reporting(E_ALL);
ini_set('display_errors', 0); // Set to 1 for debugging purposes
$db_servername = "localhost";
$db_username = "username";
$db_password = "definetelysecurepwd123";
$db_name = "plan_to_watch";
try {
$conn = new PDO("mysql:host=$db_servername;dbname=$db_name;charset=utf8mb4", $db_username, $db_password);
// Set PDO error mode to exception
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch(PDOException $e) {
echo "Connection failed: " . $e->getMessage();
exit();
}
?>