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

[eluser]maria clara[/eluser]
[quote author="cahva" date="1266844929"]Do not remove it from function attribute. Remove it from $this->db->delete
Code:
// original
$this->db->delete('maint_company',$data);

// remove $data
$this->db->delete('maint_company');

Same goes for the other $this->db->delete[/quote]

ahh ok got it. i have this code now. but it still not deleting the record. and it was not deleted also in the database

model:

Code:
function delete($data) //Query function use to delete detail user
    {
                
        // Below equals DELETE FROM maint_company WHERE company_id = [company_id]
        $this->db->where('company_id', $data['company_id']);
        $this->db->delete('maint_company');
        
        // Below equals DELETE FROM sec_companyaccess WHERE user_id = [user_id] AND company_id = [company_id]
        //$this->db->where('user_id', $data['user_id']);
        $this->db->where('company_id', $data['company_id']);
        $this->db->delete('sec_companyaccess');
        
       }

controller:

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

                
            }


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