Skip to content

Instantly share code, notes, and snippets.

@rob1121
Created May 16, 2018 15:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rob1121/d48338597eecfa91990ccf010bb448b5 to your computer and use it in GitHub Desktop.
Save rob1121/d48338597eecfa91990ccf010bb448b5 to your computer and use it in GitHub Desktop.
connect to database using PDO
<?php
try {
$conn = new PDO('mysql:host=127.0.0.1;dbname=app', 'root', '');
$connt->setAttr(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch(PDOException $e) {
echo $e->getMessage();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment