Created
September 19, 2019 18:25
-
-
Save parzibyte/a467e721b8895fc2dc60882b62b991b2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function open($ruta_de_guardado, $nombre_de_sesion) | |
{ | |
$pass = ""; // Contraseña del servidor MySQL | |
$usuario = "root"; // Usuario de MySQL | |
$nombre_base_de_datos = "test"; // El nombre de la base de datos (no el de la tabla) | |
$host = "localhost"; // El host, normalmente localhost pero puede ser una IP en algunos casos | |
try { | |
$this->base_de_datos = new PDO('mysql:host=' . $host | |
. ';dbname=' . $nombre_base_de_datos, | |
$usuario, $pass); | |
return true; | |
} catch (Exception $e) { | |
//TODO: Imprimir o guardar el mensaje en un log | |
return false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment