Posted By

kaartz on 08/16/10


Tagged

mysql php pdo


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

sapphiriq


PDO Connect - MySQL


 / Published in: PHP
 

  1. $hostname = 'localhost';
  2. $username = 'username';
  3. $password = 'password';
  4.  
  5. try {
  6. $dbh = new PDO("mysql:host=$hostname;dbname=mysql", $username, $password);
  7. }
  8. catch(PDOException $e)
  9. {
  10. echo $e->getMessage();
  11. }

Report this snippet  

You need to login to post a comment.