Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Users {
- //table
- protected $users = 'users';
- //columns
- protected $user_id = 'user_id';
- protected $username = 'user_name';
- protected $password = 'user_password';
- }
- class Emails extends Users {
- protected $emails = 'emails';
- protected $address = 'email_address';
- protected $confirm = 'email_confirmed';
- //the foreign key user_id is already defined in users
- function getUserEmail($username) {
- $join = junct([$this->users, $this->emails], $this->user_id);
- $sql = select($join, [$this->address], [$this->username]);
- $result = prepped_query($sql, $username);
- return $result;
- }
- }
- $x = new Emails();
- $email = $x->getUserEmail($username);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement