Welcome Guest, Not a member yet? Register   Sign In
Making queries through call_user_func_array
#3

[eluser]ilSignorCarlo[/eluser]
[quote author="TheFuzzy0ne" date="1240769497"]I don't fully understand why this is necessary.[/quote]

Indeed it is not really necessary.

Quote:if you can be a bit specific about what your trying to achieve, that would really help.

Code:
function get_latest($table, $limit, $where_array=array())
     {
       $this->db->orderby('Data', 'desc');

       if (!empty($where_array)) {
           call_user_func_array(array(&$this->db, 'where'), $where_array);          
       }
  
     $this->db->limit($limit);

     $query = $this->db->get($table);
    return $query->result();
     }


The where part should be something like: $this->db->where('Type', $type)


Messages In This Thread
Making queries through call_user_func_array - by El Forum - 04-26-2009, 07:06 AM
Making queries through call_user_func_array - by El Forum - 04-26-2009, 07:11 AM
Making queries through call_user_func_array - by El Forum - 04-26-2009, 07:32 AM
Making queries through call_user_func_array - by El Forum - 04-26-2009, 07:35 AM



Theme © iAndrew 2016 - Forum software by © MyBB