26 lines
612 B
PHP
26 lines
612 B
PHP
<?php
|
|
class Conexion{
|
|
private $host = "localhost";
|
|
private $dbname = "lania_cc";
|
|
private $user = "root";
|
|
private $password = "password";
|
|
private $conexion;
|
|
|
|
|
|
public function conectar() {
|
|
$this->conexion = new mysqli($this->host, $this->user, $this->password, $this->dbname);
|
|
|
|
if ($this->conexion->connect_error) {
|
|
die('Error de conexión: ' . $this->conexion->connect_error);
|
|
}
|
|
|
|
return $this->conexion;
|
|
}
|
|
|
|
public function cerrarConexion() {
|
|
if ($this->conexion) {
|
|
$this->conexion->close();
|
|
}
|
|
}
|
|
}
|
|
?>
|