Welcome Guest, Not a member yet? Register   Sign In
Loop inside a loop in controller.. help needed....:(
#4

[eluser]Roy MJ[/eluser]
figured out.. but not sure this is the actual way.. Tongue

Code:
function get_total($id)
    {
        $count=0;
        $this->db->select('COUNT(friends.id) AS total');
        $this->db->distinct();
        $this->db->from('friends');
        $this->db->join('members','friends.member_id');
        $this->db->where('friends.member_id =', $id);
        $this->db->where('friends.status =', 1);
        $result_total = $this->db->get();
        if($result_total->num_rows()>0){
            $row    = $result_total->row();
            $count    =    $row->total;
        }
        return $count;
    }
   function select_friends($limit,$pgoffset,$id)
   {
           $this->db->select('members.id,members.screenname,members.photo,members.email');
           $this->db->limit($limit,$pgoffset);
        $this->db->distinct();
        $this->db->from('members');
        $this->db->join('friends','friends.member_id');
        $this->db->where('friends.member_id =', $id);
        $this->db->where('friends.status =', 1);
        $result_news = $this->db->get();
          return $result_news->result();
   }


Messages In This Thread
Loop inside a loop in controller.. help needed....:( - by El Forum - 04-03-2011, 11:21 PM
Loop inside a loop in controller.. help needed....:( - by El Forum - 04-03-2011, 11:28 PM
Loop inside a loop in controller.. help needed....:( - by El Forum - 04-04-2011, 12:19 AM
Loop inside a loop in controller.. help needed....:( - by El Forum - 04-04-2011, 01:07 AM
Loop inside a loop in controller.. help needed....:( - by El Forum - 04-04-2011, 11:59 PM
Loop inside a loop in controller.. help needed....:( - by El Forum - 04-05-2011, 12:12 AM
Loop inside a loop in controller.. help needed....:( - by El Forum - 04-05-2011, 12:22 AM
Loop inside a loop in controller.. help needed....:( - by El Forum - 04-05-2011, 12:29 AM



Theme © iAndrew 2016 - Forum software by © MyBB