File "Database.php"

Full Path: C:/wamp64/www/Seleccion/config/Database.php
File size: 907 bytes
MIME-type: text/x-php
Charset: utf-8

<?php
// config/Database.php

class Database {
    private $host = '192.200.100.40';
    private $db_name = 'sanmarino_seleccion';
    private $username = 'SANMARINO';
    private $password = 'sanmarino2021*';
    private $conn;

    public function connect() {
        $this->conn = null;

        try {
            $this->conn = new PDO(
                'mysql:host=' . $this->host . ';dbname=' . $this->db_name . ';charset=utf8mb4',
                $this->username,
                $this->password,
                [
                    PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
                    PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
                    PDO::ATTR_EMULATE_PREPARES => false
                ]
            );
        } catch(PDOException $e) {
            echo 'Error de conexión: ' . $e->getMessage();
            die();
        }

        return $this->conn;
    }
}
?>