Last active
January 13, 2018 19:33
-
-
Save nunomazer/5453844 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
define('DB_DRIVER', 'mysql'); | |
define('DB_HOST', 'localhost'); | |
define('DB_USER', 'root'); | |
define('DB_PWD', 'minhasenha'); | |
define('DB_DATABASE', 'meubancodedados'); | |
try { | |
$pdo = new PDO(DB_DRIVER.':host='.DB_HOST.';dbname='.DB_DATABASE, DB_USER, DB_PWD); | |
if ($pdo) { | |
echo "Conexão realizada com sucesso!"; | |
} else { | |
echo "Problemas na conexão!"; | |
} | |
} catch (PDOException $exc) { | |
echo "Problemas na conexão!"; | |
echo $exc->getMessage(). | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment