I basically wanna do what I'd call nested queries (but not in the nested SELECT way) using CodeIgniter's Active Record.
So it would be like putting aside the current AR context to run a new query before restoring it.
A concrete example:
function handle_form($fields, $POST)
{
foreach ($开发者_开发百科fields as $field)
{
if ($field->type == "file")
do_upload($field->post); //This function does insert data in another table using AR too
$this->db->set($field->name, $POST[$field->post]);
}
$this->db->insert('table');
}
I haven't found any resources about that, maybe I'm just using the wrong keywords.. Thanks for your help !
function handle_form($fields, $POST)
{
$data = array();
foreach ($fields as $field)
{
if ($field->type == "file")
do_upload($field->post);
$data[$field->name] = $POST[$field->post];
}
$this->db->insert('table', $data);
}
精彩评论