Welcome Guest, Not a member yet? Register   Sign In
[SOLVED] delete row
#4

[eluser]theprodigy[/eluser]
[quote author="maria clara" date="1266314522"]hi, i have noticed the call to undefined method :: delete_detail so i already changed it.

MODEL:
Code:
function delete($data) //Query function use to delete user
    {
        
        $deleted_row = $data['company_code'];
        
        $data['is_deleted'] = '1';
        $this->db->where('company_id', $data['company_id']);
        $this->db->update('maint_company', $data);
    
        $this->db->where('user_id', $id['user_id']);
        $this->db->update('sec_companyaccess', $id);
        
        return $deleted_row;

    }

CONTROLLER:
Code:
case $crudConfig['delete']:
  $this->db->where('company_id', $this->input->post('id'));
  $this->db->delete($crudTableName);        
  break;

NOTE:
yes i hope this will not go up to page 8. :lol:

it was deleting at first but when i refreshed the page the one i deleted comes back in..how can i delete it the right way???[/quote]
Ok, once again, in your controller, why are you calling it on db, and not the model name?
Your Controller needs something like:
Code:
$this->load->model('[MODEL_NAME]'); // if the model isn't already loaded
  $this->MODEL_NAME->delete($crudTableName);
As it is right now, you are calling it on the db and not ever touching your model. It told you that the function doesn't exist, because CI's db class doesn't have a function by that name. Changing the method name to delete, won't necessarily throw an error, because it contains a delete method. You are having your controller do what the model should be doing.


Messages In This Thread
[SOLVED] delete row - by El Forum - 02-15-2010, 08:49 PM
[SOLVED] delete row - by El Forum - 02-15-2010, 09:33 PM
[SOLVED] delete row - by El Forum - 02-15-2010, 10:02 PM
[SOLVED] delete row - by El Forum - 02-15-2010, 10:09 PM
[SOLVED] delete row - by El Forum - 02-15-2010, 11:43 PM
[SOLVED] delete row - by El Forum - 02-15-2010, 11:50 PM
[SOLVED] delete row - by El Forum - 02-15-2010, 11:57 PM
[SOLVED] delete row - by El Forum - 02-16-2010, 12:03 AM
[SOLVED] delete row - by El Forum - 02-16-2010, 12:09 AM
[SOLVED] delete row - by El Forum - 02-16-2010, 12:26 AM
[SOLVED] delete row - by El Forum - 02-17-2010, 08:04 PM
[SOLVED] delete row - by El Forum - 02-17-2010, 08:49 PM
[SOLVED] delete row - by El Forum - 02-17-2010, 09:00 PM
[SOLVED] delete row - by El Forum - 02-17-2010, 10:12 PM
[SOLVED] delete row - by El Forum - 02-17-2010, 10:54 PM
[SOLVED] delete row - by El Forum - 02-18-2010, 12:37 AM
[SOLVED] delete row - by El Forum - 02-18-2010, 12:54 AM
[SOLVED] delete row - by El Forum - 02-18-2010, 09:32 AM
[SOLVED] delete row - by El Forum - 02-21-2010, 07:09 PM
[SOLVED] delete row - by El Forum - 02-22-2010, 01:22 AM
[SOLVED] delete row - by El Forum - 02-22-2010, 01:28 AM
[SOLVED] delete row - by El Forum - 02-22-2010, 02:42 AM
[SOLVED] delete row - by El Forum - 03-03-2010, 01:17 AM



Theme © iAndrew 2016 - Forum software by © MyBB