Guest User

Untitled

a guest
Oct 26th, 2017
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. <?php
  2.  
  3. class PDOconnect{
  4.  
  5. const HOST= CON_HOST;
  6. const DB= CON_DB;
  7. const USERNAME= CON_USERNAME;
  8. const PASSWORD= CON_PASSWORD;
  9.  
  10. private function getConnection(){
  11. $username = self::USERNAME;
  12. $password = self::PASSWORD;
  13. $host = self::HOST;
  14. $db = self::DB;
  15. $connection = new PDO("mysql:dbname=$db;host=$host", $username, $password);
  16. return $connection;
  17. }
  18. public function queryList($sql, $args){
  19. $connection = $this->getConnection();
  20. $stmt = $connection->prepare($sql);
  21. $stmt->execute($args);
  22. return $stmt;
  23. }
  24. }
  25.  
  26. ?>
Add Comment
Please, Sign In to add comment