[eluser]ilSignorCarlo[/eluser]
Hi,
I'm writing a CodeIgniter model whith some database utilities. What I'm trying to do is to write a function to create customizable queries.
The idea is to pass to the function a table name, a number (to limit results), and an optional array with parameters for the "where" clause. Inside the function I just test if the array is not empty and just in this case I use the "where" clause.
I'm pretty new to PHP and to CodeIgniter too, but I found that I can do this with the call_user_func_array function.
so I call it this way:
Code:
if (!empty($where_array)) {
call_user_func_array(array(&$this->db, 'where'), $where_array);
}
The problem, I think, is that where() needs a pair of values. How can I do this?
Anyway, is what I'm trying to do a good practice?
Thanks,
Bye