Created
November 12, 2020 17:28
-
-
Save Asselberghs/2bd703314de635706b37ef13512f4a6f to your computer and use it in GitHub Desktop.
Connect
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
step 1: | |
Connect to db: | |
$dsn = 'mysql:dbname=Database_Name;host=IP_Address'; | |
$user = 'Username'; | |
$pass = 'Password'; | |
try { | |
$db = new PDO($dsn, $user, $pass); | |
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); | |
} | |
catch(PDOException $e) { | |
die('Could not connect to database:<br />' . $e->getMessage()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment