Open EMMANUELRHZ opened 4 years ago
`<?php
class DB{ private $host; private $db; private $user; private $password; private $charset;
public function __construct(){
$this->host = 'localhost';
$this->db = 'iniciosesion';
$this->user = 'root';
$this->password = "";
$this->charset = 'utf8mb4';
}
function connect(){
try{
$connection = "mysql:host=" . $this->host . ";dbname=" . $this->db . ";charset=" . $this->charset;
$options = [
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_EMULATE_PREPARES => false,
];
$pdo = new PDO($connection, $this->user, $this->password, $options);
return $pdo;
}catch(PDOException $e){
print_r('Error connection: ' . $e->getMessage());
}
}
}
?>
`
se creo la conexion
se debe crear una base de datos para que se creen las tablas correspondientes y almacenar la información de los admin