Welcome Guest, Not a member yet? Register   Sign In
using active record (delete)
#1

[eluser]kikz4life[/eluser]
hi, still newbie to CI, i have this code in standard php. Now i want to use the CI active record (crud). Can anyone help me with this.? I tried modifying it and using the CI active record in delete.
Code:
$this->db->delete('sec_role', array('role_id' => $crudColumnValues['id']));
or like this
$this->db->where('erp_sec_role.role_id', $crudColumnValues['id']);
$this->db->delete('erp_sec_role');
but still wont work Sad

this is the standard code
Code:
case $crudConfig['create']:
                $sql = 'insert into '.$crudTableName.'(';
                $sql .= implode(',',$crudColumns);
                $sql .= ')VALUES(';
                $sql .= implode(',',$crudColumnValues);
                $sql .= ')';
                mysql_query( $sql );
                break;
            case $crudConfig['update']:
                $sql = 'update '.$crudTableName.' set ';
                foreach($crudColumns as $key => $value){ $updateArray[$key] = $value.'='.$crudColumnValues[$key]; };
                $sql .= implode(',',$updateArray);
                $sql .= ' where role_id = '.$crudColumnValues['id'];
                mysql_query( $sql );
                break;
            case $crudConfig['delete']:

                $sql = 'Delete from '.$crudTableName.' where role_id = '.$crudColumnValues['id'];
                mysql_query( $sql );
                break;
            }


any suggestion or pointer will be a great help for me. Smile

thanks thanks


Messages In This Thread
using active record (delete) - by El Forum - 12-28-2009, 03:07 AM
using active record (delete) - by El Forum - 12-28-2009, 03:41 AM
using active record (delete) - by El Forum - 12-28-2009, 04:31 AM
using active record (delete) - by El Forum - 12-28-2009, 07:57 PM
using active record (delete) - by El Forum - 12-28-2009, 08:18 PM
using active record (delete) - by El Forum - 12-28-2009, 09:14 PM
using active record (delete) - by El Forum - 12-28-2009, 11:39 PM



Theme © iAndrew 2016 - Forum software by © MyBB