Welcome Guest, Not a member yet? Register   Sign In
[split] CI 3.1.2 Batch update not working
#1

(This post was last modified: 11-10-2016, 10:02 AM by ciadmin.)

please help after i update 3.1.1 to 3.1.2 my update_batch not working


Code:
 $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
               }
error sql syntax the following 

Code:
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

if i restore to version 3.1.1  it work but after update it give error above i had no idea
Reply
#2

(This post was last modified: 12-09-2016, 06:08 AM by matrox445.)

Hello,

Same problem here. You have to reverse the changes for 2 functions (update_batch and _update_batch) in the DB_query_builder file (system/database). Just copy / paste the functions of 3.1.1 version, it works for me.

Bye
Reply




Theme © iAndrew 2016 - Forum software by © MyBB