<?php
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS");
header("Access-Control-Allow-Headers: Content-Type");

$host = "localhost";
$user = "infoappdevadmin_react_crud";
$pass = "]E8zVYz[8nCYofJ^";
$dbname = "infoappdevadmin_react_crud";

$conn = new mysqli($host, $user, $pass, $dbname);

try {
    $pdo = new PDO("mysql:host=$host;dbname=$dbname;charset=utf8", $user, $pass);
    $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (PDOException $e) {
    die("Database connection failed: " . $e->getMessage());
}
// if ($conn->connect_error) {
//   die(json_encode(["error" => "Database connection failed"]));
// }
?>
