I am using CodeIgniter. Below code, I am using in the model.
My issue is, I have to display the output of the join as well as I am using one more condition inside If condition that output I also need.
What I am doing is, I am fetching the records from the multiple tables and passing membershipForTheYear
column name in the IF condtion.
membershipForTheYear output is the year range like 2018-2019.
I am breaking it using explode and changing from 2018-2019 to 2019-2020 to get the output from the table. Now I have to display the output of the this and joins on view.
Why I am doing this because I have to display the next year fees with above joins output.
Should I return two results or I have to use some array?
Would you help me out in this?
public function upcomingData(){
$get_s_member = array('members.is_Approved'=>1,'members.is_status'=>1);
$this->db->select('*');
$this->db->from('members');
$this->db->join('membership_details', 'members.member_id = membership_details.member_id','LEFT');
$this->db->where($get_s_member);
$this->db->group_by('membership_details.member_id');
$this->db->order_by('membership_details.membership_added_date','DESC');
$query = $this->db->get();
$result = $query->result();
if($result)
{
foreach ($result as $key => $value) {
$membershipForTheYear=explode('-',$value->membershipForTheYear);
$addNextyear=$membershipForTheYear[1] + 1;
$activeBTN=$membershipForTheYear[1].'-'.$addNextyear;
$where = array('Duration'=>$activeBTN,'is_FeesActive'=>1);
$result = $this->db->where($where)
->from('bMembershipFees')
->get()
->row();
// print_r($result);
}
return $result;
}
else
{
return 0;
}
}