Welcome Guest, Not a member yet? Register   Sign In
updateBatch(): Argument #2 ($index) must be of type string
#1

(This post was last modified: 03-11-2024, 01:58 PM by ramonpuig.)

Hello!

I am getting this exception :

CodeIgniter\Database\BaseBuilder::updateBatch(): Argument #2 ($index) must be of type ?string, array given
My code is this , its in a function inside my model.

PHP Code:
$db $this->db;

    $builder $db->table($this->table);
    $builder->updateBatch($data,['date','name''winner_name','runnerUp_name''titleAvgEloRating''matchID']); 
In the CI4 documentation the example :
PHP Code:
$data = [
    [
        'title'  => 'Title 1',
        'author' => 'Author 1',
        'name'  => 'Name 1',
        'date'  => 'Date 1',
    ],
    [
        'title'  => 'Title 2',
        'author' => 'Author 2',
        'name'  => 'Name 2',
        'date'  => 'Date 2',
    ],
];
$builder->updateBatch($data, ['title''author']); 


Does not appear to show second argument as a String, but as an array. I am doing something wrong? Or is there a bug here?
Reply


Messages In This Thread
updateBatch(): Argument #2 ($index) must be of type string - by ramonpuig - 03-11-2024, 01:56 PM



Theme © iAndrew 2016 - Forum software by © MyBB