[eluser]maria clara[/eluser]
[quote author="theprodigy" date="1265374720"]if you aren't going to be using User, then don't load it. Load the other one (sec_companyaccess). And nothing is stopping you from loading both (if you need both in this controller).[/quote]
but i need to load also the 'User' for my master grid.
note: code for saving in the master grid;
Code:
elseif ($data['action']=='save')
{
$item = $this->input->post("item");
$dt['username'] = $this->input->post('username');
$sec_exist = $this->User->getDetails($dt);
if ($sec_exist && $item!=$sec_exist['user_id'])
{
$c .= 'User ID already exists.';
$data['action'] = 'exist';
}
else
{
$fields = array(
"username"
,"last_name"
,"first_name"
,"middle_initial"
,"role_id"
,"dept_id"
);
foreach ($fields as $field)
{
if (isset($_POST[$field])) $dt[$field] = $this->input->post($field);
}
$item = $this->input->post("item");
and while the sec_companyaccess_db and the maint_company_db is for my detail grid..
here code for saving in the detail grid:
Code:
case $crudConfig['create']:
$c = "";
$id['company_code'] = $this->input->post('company_code');
$sec_exist = $this->Main_company_db->getDetailList($id);
if ($sec_exist)
{
$c .= 'Company ID already exists.';
$data['action'] = 'exist';
}
else
{
$fields = array(
"company_code"
,"company_name"
);
foreach ($fields as $field)
{if (isset($_POST[$field])) $id[$field] = $this->input->post($field);}
$item = $this->input->post("item");
$data['item'] = $this->Main_company_db->save_detail($id,$item);
}
break;
how can i load two model in the same controller???