Advertisement
Guest User

Untitled

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