This commit is contained in:
Alfredo Lima
2020-02-26 15:43:19 -06:00
commit 9f2001c549
51 changed files with 42593 additions and 0 deletions
+38
View File
@@ -0,0 +1,38 @@
<?php
class Conexion{
private static $conexion;
public static function abrirConexion(){
if(!isset(self::$conexion)){
try {
include_once 'config.bd.php';
self::$conexion = new PDO($DB, $userName, $Password);
self::$conexion ->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
self::$conexion -> exec('SET CHARACTER SET utf8');
} catch (PDOException $e) {
echo 'Falló la conexión: ' . $e->getMessage();
die();
}
}
}
public static function cerrarConexion(){
if(isset(self::$conexion)){
self::$conexion = null;
}
}
public static function obtenerConexion(){
return self::$conexion;
}
}
?>