更新3.1.1到3.1.2后的Codeigniter错误batch_update

时间:2016-11-10 15:10:00

标签: php codeigniter

由于我运行Codeigniter 3.1.1没有问题只是几次更新我没有检查我的幻灯片更改位置ID和Codeigniter 3.1.2上的错误

$data = [
    ['sl_id' =>  49, 'sl_move' => 1],
    ['sl_id' => 48, 'sl_move' => 2]
];

// error this update_batch line : Undefined index: sl_id

if( ! $this->db->update_batch($this->table, $data, 'sl_id'))
{
    //FALSE
}
else
{
    //TRUE
}

错误显示在下面的SQl语法:

Error Number: 1064

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'THEN '49' WHEN `sl_id` = THEN '48' ELSE `sl_id` END, `sl_move` = CASE WHEN `sl' at line 2

UPDATE `tbl_slide` SET `sl_id` = CASE WHEN `sl_id` = THEN '49' WHEN `sl_id` = THEN '48' ELSE `sl_id` END, `sl_move` = CASE WHEN `sl_id` = THEN '1' WHEN `sl_id` = THEN '2' ELSE `sl_move` END WHERE `sl_id` IN(,)

Filename: C:/wamp/www/CodeIgniter_Project/system/database/DB_driver.php

Line Number: 691

0 个答案:

没有答案