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

[eluser]maria clara[/eluser]
[quote author="theprodigy" date="1266487932"]show me your model code please[/quote]

here is my model

Code:
function delete($data) //Query function use to delete detail user
    {
        #$deleted_row = $data['company_code'];
        
        //$data['maint_company.is_deleted'] = '1';
        $this->db->where('company_id', $data['company_id']);
        $this->db->update('maint_company',$data); // need to DELETE, not UPDATE
        //echo $this->db->last_query(); //<----- put this here  
        //$this->db->where('user_id', $data['user_id']);
        //$this->db->where('company_id', $data['company_id']); //need this field too or will delete ALL the companies associated with the user
        $this->db->update('sec_companyaccess', $data); // need to DELETE, not UPDATE
        echo $this->db->last_query(); //<----- put this here  
        #return $deleted_row;
    }


controller

Code:
case $crudConfig['delete']:  // kaht code -deleting but have error
                //$data['table_name'] = $crudTableName;
                $data['company_id'] = $this->input->post('id'); // and make sure are posting this data
                //$data['user_id'] = $this->input->post('user_id'); // and make sure are posting this data
                $this->User->delete($data); //<----- need to pass the company data, the user id, and the table name to the query

        /*    case $crudConfig['delete']:
                $this->db->where('company_id', $this->input->post('id'));
                #$this->User->delete($crudTableName);
                $this->db->delete($crudTableName);*/
            }


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