How to search for a specific value (email and password) for login purposes between two tables (tbl_admin & tbl_users) in database codeigniter 3?

Viewed 20
<?php

class Login_model extends CI_Model
{
    public function __construct()
    {
        parent::__construct();

        $this->load->database();
    }

    public function login($email, $pass)
    {
        // $query = $this->db->get_where('tbl_admin', 'patient_record',['email' => $email, 'password' => $pass]);
        // return $query->row();

        $query = $this->db->select('ta.*', 'pr.*')
            ->from('tbl_admin ta')
            ->join('patient_record pr', 'ta.admin_id = pr.patient_id')
            ->where('ta.email', $email)
            ->where('ta.password', $pass)
            ->get();
        return $query->row();
    }
}

?>

I need to search for tables admin table (tbL_admin) and patient table (patient_rec) with the matching email & password value

this current code of mine only seems to get results from tbl_admin table

0 Answers
Related