Advertisement
Guest User

Untitled

a guest
Jul 12th, 2014
1,298
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.89 KB | None | 0 0
  1. <?
  2. // ----------------------------------------------------------------------------------------------------
  3. //                                       Connecting to database
  4. // ----------------------------------------------------------------------------------------------------
  5. // Database variables
  6. $username = "";
  7. $password = "";
  8. $hostname = "";
  9. $database = "";
  10.  
  11. // Try to connect to database and set charset to UTF8
  12. try {
  13.     $dbConnect = new PDO("mysql:host=$hostname;dbname=$database;charset=utf8", $username, $password);
  14.     $dbConnect->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  15.  
  16. } catch(PDOException $e) {
  17.     echo 'ERROR: ' . $e->getMessage();
  18. }
  19. // ----------------------------------------------------------------------------------------------------
  20. //                                      / Connecting to database
  21. // ----------------------------------------------------------------------------------------------------
  22. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement