Advertisement
Guest User

Untitled

a guest
Mar 16th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. <?php
  2.  
  3. /**
  4. *@filename DBConnection.php
  5. *@desc Creates a connection with the mysql DB
  6. */
  7. $dbName = "com2701"; // name of the db you want to use
  8. $dbHost = "mysql:host=localhost;dbname=". $dbName;
  9. $dbUser = "root";
  10. $dbPassword = "";
  11. $conn = null;
  12.  
  13. try {
  14.  
  15. $conn = new PDO($dbHost , $dbUser, $dbPassword);
  16. print("Connection Established!");
  17.  
  18.  
  19. }catch(PDOException $e){
  20.  
  21. print("Not Connected". $e->getMessage());
  22.  
  23. }
  24.  
  25.  
  26. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement