I need to insert query result as input of another query Here is the code that I have tried,Please I need help immediately I need to get id from query1 and insert it in query2 as $id
class Get_db extends CI_Model{
public function get_All(){
$query1 = $this->db->query("SELECT name,id from companydetails");
return $query->result();
}
public function getBranches(){
$query2 = $this->db->query("SELECT branches.name FROM branches WHERE branches.companyid=$id ");
return $query2->result();
}
}
I need to get id from query1 and insert it in query2 as $id