Guest User

Untitled

a guest
Feb 4th, 2019
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. <?php
  2.  
  3. class Connection{
  4. function getConnection(){
  5. $host = "localhost";
  6. $username = "root";
  7. $password = "";
  8. $dbname = "pagination";
  9.  
  10. try{
  11. $conn = new PDO("mysql:host=$host;dbname=$dbname", $username, $password);
  12. $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  13. return $conn;
  14. }catch(PDOException $ex){
  15. echo "Error koneksi ke database : " . $ex.getMessage();
  16. }
  17. }
  18. }
  19.  
  20. ?>
Add Comment
Please, Sign In to add comment