Codeigniter错误在oracle数据库中执行update命令。 DB_driver.php,行号:330

时间:2015-03-29 10:24:18

标签: php oracle codeigniter

当我要从codeigniter更新oracle db中的表时,我收到错误,

  

错误号码:   更新BOTAB SET   STATUS =' Y',TERMINAL =' fazlay-PC',SLNO =' 101',REGNO =' 36'哪里   BOAC =' 1204260035198795&#39 ;;文件名:   C:\ XAMPP \ htdocs中\ agm_ci \ SYSTEM \数据库\ DB_driver.php   行号:330

然而,我的项目从这张表中顺利执行SELECT命令。

这是我的模特函数.....

public function updateStatus($data)
{
    $update_data['regno'] = $data['regno'];
    $update_data['attendence'] = $data['attendence'];
    $update_data['terminal'] = $data['terminal'];
    $update_data['slno'] = $data['slno'];
    $update_data['index'] = $data['index'];

    $query = $this -> db -> query("UPDATE BOTAB SET STATUS='".$update_data['attendence']."',TERMINAL='".$update_data['terminal']."',SLNO='".$update_data['slno']."',REGNO='".$update_data['regno']."'  
    WHERE BOAC='".$update_data['index']."'; ");
}

我的db配置如下.....

$db['default']['hostname'] = $tnsname;
$db['default']['username'] = 'XXXXX';
$db['default']['password'] = 'XXXXX';
$db['default']['database'] = '';
$db['default']['dbdriver'] = 'oci8';
$db['default']['dbprefix'] = '';
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = '';
$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_general_ci';
$db['default']['swap_pre'] = '';
$db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE;

提前致谢。

1 个答案:

答案 0 :(得分:0)

为什么不使用内置更新功能的codeigniter 它可能适合你

    $update_data['STATUS']=$data['attendence'];
    $update_data['TERMINAL']=$data['terminal'];
    $update_data['SLNO']=$data['slno'];
    $update_data['REGNO']=$data['regno'];

    $this->db->where('BOAC',$data['index']);
    $this->db->update('BOTAB',$update_data);