Guest User

Untitled

a guest
Oct 30th, 2016
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. <?php
  2.  
  3. session_start();
  4.  
  5. function connection(){
  6. $db_host = 'localhost';
  7. $db_name = 'addressb';
  8. $db_user = 'root';
  9. $db_password = '';
  10.  
  11. try {
  12. $db = new PDO("mysql:host=$db_host;dbname=$db_name", $db_user, $db_password);
  13. return $db;
  14. }catch (PDOException $e) {
  15. echo "Error: " . $e->getMessage();
  16. die();
  17. }
  18. }
Add Comment
Please, Sign In to add comment