Welcome Guest, Not a member yet? Register   Sign In
multiple elements call same models
#2

[eluser]Lenouv[/eluser]
Re-

The "only" way i found doesn't work :/
How i do it:
- I generate an aleatory name for the model depends on the list_id of the element
- I call the model with this new model_name
- I call the model function to save or update element.

My code:
Code:
public function _save($list_id = NULL){
        $model_name = 'Typeelement_model';
        if($list_id != NULL && is_int($list_id))
            $model_name .= $list_id.mt_rand(1,100);
        $this->load->model('Typeelement_model', $model_name);
        $this->$model_name->saveAll($datas);
}

How can I do?


Messages In This Thread
multiple elements call same models - by El Forum - 08-10-2011, 09:58 AM
multiple elements call same models - by El Forum - 08-11-2011, 08:44 AM
multiple elements call same models - by El Forum - 08-12-2011, 07:49 AM
multiple elements call same models - by El Forum - 08-12-2011, 09:04 AM



Theme © iAndrew 2016 - Forum software by © MyBB