×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: PHP
Posted by: Thomas Seaford
Added: Nov 25, 2014 4:09 AM
Modified: Nov 25, 2014 5:08 AM
Views: 37
PDO Database Definition
  1.     $dsn='mysql:host=[DBHOST];dbname=[DBNAME]';
  2.     $username = '[DBUSERNAME]';
  3.     $password = '[DBPASSWORD]';
  4.  
  5.     try{
  6.  
  7.         $db = new PDO($dsn, $username, $password);
  8.  
  9.     }catch(PDOException $e){
  10.  
  11.         echo "there was a problem with the database connection";
  12.  
  13.     }
  14.  
  15.     //echo "database connected";