Created
March 13, 2018 17:19
-
-
Save parzibyte/56a21454482d702db11c4365772ac346 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 | |
$contraseña = "1d3ed423r43crt34"; | |
$usuario = "root"; | |
$nombre_base_de_datos = "ventas"; | |
try{ | |
$base_de_datos = new PDO('mysql:host=localhost;dbname=' . $nombre_base_de_datos, $usuario, $contraseña); | |
$base_de_datos->query("set names utf8;"); | |
$base_de_datos->setAttribute(PDO::ATTR_EMULATE_PREPARES, FALSE); | |
$base_de_datos->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); | |
$base_de_datos->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_OBJ); | |
}catch(Exception $e){ | |
echo "Ocurrió algo con la base de datos: " . $e->getMessage(); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment