Last active
August 29, 2015 14:27
-
-
Save terrymun/b482da2e43b06c7d2413 to your computer and use it in GitHub Desktop.
Connecting to the MySQL database using PDO
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 | |
| // Establish a new database connection | |
| // Barebones edition | |
| $db = new PDO('mysql:host='.DB_HOST.';dbname='.DB_NAME, DB_USER, DB_PASS); | |
| // Advanced edition | |
| $db = new PDO('mysql:host='.DB_HOST.';dbname='.DB_NAME.';charset=utf8;port=3306', DB_USER, DB_PASS); | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment