Guest User

Untitled

a guest
Oct 24th, 2016
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. Class Database
  2. {
  3. public $db;
  4. public $name = "root";
  5. public $dsn = "mysql:host=localhost;dbname=Users;charset=UTF-8";
  6. public $password = "";
  7.  
  8. public function __construct() {
  9. $this->db = new PDO($this->dsn, $this->name, $this->password);
  10. }
  11.  
  12. public function find_login($login) {
  13. $sql = $this->db->query('SELECT login FROM Users WHERE login = {$login}');
  14. return $sql->rowCount();
  15. }
  16.  
  17. public function find_mail($mail) {
  18. $sql = $this->db->query('SELECT login FROM Users WHERE mail = {$mail}');
  19. return $sql->rowCount();
  20.  
  21. }
  22. }
Add Comment
Please, Sign In to add comment