anime-backlog-list/php/db_connect.example.php

20 lines
539 B
PHP
Raw Normal View History

2025-01-07 12:23:54 +05:00
<?php
session_start();
error_reporting(E_ALL);
ini_set('display_errors', 0); // Set to 1 for debugging purposes
$servername = "localhost";
$username = "username";
$password = "definetelysecurepwd123";
$dbname = "plan_to_watch";
try {
$conn = new PDO("mysql:host=$servername;dbname=$dbname;charset=utf8mb4", $username, $password);
// Set PDO error mode to exception
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch(PDOException $e) {
echo "Connection failed: " . $e->getMessage();
exit();
}
?>