SW/assets/php/dao.php
2021-03-24 21:35:59 +01:00

25 lines
663 B
PHP
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
// TO-DO: Completar
class DAO {
public $mysqli;
public function __construct(){
try{
if (!$this->mysqli) {
$this->mysqli = new mysqli('127.0.0.1', 'sw',
'_admin_', 'complucine');
}
// echo "Conexión a la BD, satisfactoria.";
} catch (Exception $e){
echo "Error de conexión a la BD: ". mysqli_connect_error();
exit();
}
/* ... */
}
public function __destruct(){
$this->mysqli->close();
}
}
?>