Advertisement
Guest User

Untitled

a guest
Jul 18th, 2016
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: putuguna
  5. * Date: 7/18/2016
  6. * Time: 8:06 AM
  7. */
  8. class ConnectionDB {
  9. function getConnection(){
  10. $host = "localhost";
  11. $username = "root";
  12. $password = "";
  13. try{
  14. $conn = new PDO("mysql:host=$host;dbname=testlogin", $username, $password);
  15. $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  16. return $conn;
  17. }catch (PDOException $e){
  18. echo "ERROR : " .$e->getMessage();
  19. }
  20. }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement