Welcome Guest, Not a member yet? Register   Sign In
Tell me your Ideas (notification system)
#3

[eluser]munkeh[/eluser]
Something like this?

Code:
function get_notification($some_index, $num_results=NULL) {

    $this->db->select('whatever','data','you','need');
    $this->db->from('notification_table');
    $this->db->where('index', $some_index);
    $this->db->order_by('id', "desc");
    
    if (isset($num_results)) {$this->db->limit($num_results);}
    
    $query = $this->db->get();
    $num_rows = $query->num_rows();
    
    if ($num_rows == 0)
    {
        return FALSE;
    } else
    {
        return $query->result_array();
    }

}

then get_notification($some_index, 3) gives you the latest 3 items assuming your 'id' field auto increments. get_notification($some_index) will give you all of them.


Messages In This Thread
Tell me your Ideas (notification system) - by El Forum - 12-10-2010, 01:27 AM
Tell me your Ideas (notification system) - by El Forum - 12-10-2010, 02:47 AM
Tell me your Ideas (notification system) - by El Forum - 12-10-2010, 11:08 AM
Tell me your Ideas (notification system) - by El Forum - 12-10-2010, 03:16 PM



Theme © iAndrew 2016 - Forum software by © MyBB