Advertisement
Guest User

Untitled

a guest
Mar 26th, 2017
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. class Users {
  2. //table
  3. protected $users = 'users';
  4. //columns
  5. protected $user_id = 'user_id';
  6. protected $username = 'user_name';
  7. protected $password = 'user_password';
  8. }
  9.  
  10. class Emails extends Users {
  11. protected $emails = 'emails';
  12. protected $address = 'email_address';
  13. protected $confirm = 'email_confirmed';
  14. //the foreign key user_id is already defined in users
  15.  
  16. function getUserEmail($username) {
  17. $join = junct([$this->users, $this->emails], $this->user_id);
  18. $sql = select($join, [$this->address], [$this->username]);
  19. $result = prepped_query($sql, $username);
  20. return $result;
  21. }
  22. }
  23.  
  24. $x = new Emails();
  25. $email = $x->getUserEmail($username);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement