<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);

$dbHost = '45.84.206.101'; // Your database IP address or hostname
$dbPort = '3306'; // MySQL port number
$dbName = 'u621169360_agriex'; // Your database name
$dbUsername = 'u621169360_agriex'; // Your database username
$dbPassword = 'JAIhanumanu89@@@'; // Your database password

// PDO DSN (Data Source Name) for MySQL with persistent connection
$dsn = "mysql:host=$dbHost;port=$dbPort;dbname=$dbName;charset=utf8";

try {
    // Create a persistent PDO connection
    $pdo = new PDO($dsn, $dbUsername, $dbPassword, [
        PDO::ATTR_PERSISTENT => true, // Enable persistent connection
        PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, // Enable error reporting
    ]);

    echo "Connected to the database successfully.";
} catch (PDOException $e) {
    die("Connection failed: " . $e->getMessage());
}

// Now you can use $pdo for database operations
// Don't forget to close the connection when you're done (not necessary for persistent connections)
?>
