function get_all_notification() { //get all notification based on the 'notification' table left join by 'membership' table
$this->db->select()->from('notification')->join('membership','membership.membership_id = notification.notif_id','left'); $notif = $this->db->get();
return $notif->result();
}
I cannot display the fields from membership table.
Try this
function get_all_notification() { //get all notification based on the 'notification' table left join by 'membership' table
$this->db->select('*')->from('notification')->join('membership','membership.membership_id = notification.notif_id','left');
$notif = $this->db->get();
return $notif->result();
}
function get_all_notification()
{
$this->db->select('n.*,m.*');
$this->db->from('notification as n')
$this->db->join('membership as m','m.membership_id = n.notif_id','left');
$notif = $this->db->get();
return $notif->result();
}
This is used when you want a clean code that's from top to bottom. But using your code is fine to where as the arrows are continuous. You just forgot to identify which fields to select. Also using aliases are good in selecting specific fields.
as you can see, I used n.* and m.*, this is just a wildcard to select all from the n table and m. you can you n.your_field and m.your_field when specifying what you want.
Goodluck and have fun coding :D