[eluser]kikz4life[/eluser]
i used this code to replace my old standard php code
Code:
$sql = 'Delete from '.$crudTableName.' where role_id = '.$crudColumnValues['id'];
mysql_query( $sql );
convert to CI
$this->db->delete('sec_role', array('role_id' => $crudColumnValues['id'])); <-- dont work, dont know why
this is the code which i want to convert to CI and used the active record
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;
no error where found by firebug and i tried to echo $crudColumnValues and the result is the correct id i want to delete. Help anyone. Dont know why it wont work..
thanks in advance