XF 2.0 Double Arrow Error, Expecting ]

Cupara

Well-known member
I have this file in a repo file and I may have to move the query to the cron file itself but I wanted to avoid that if possible.

Here is the code from the Repo file throwing the error:
PHP:
    public function updateRealms($n)
    {
        $db = \XF::db();
        $db->update(
            'xwow_realms'
            [
                'realm_stat'  => $n['status'] (This is the error line)
            ]
            'realm_name =  ?',
            [$n['name']]
        );
    }

Thanks
 
Figured it out. The above is for doing more than 1 field update. The below is for just 1 field update.
PHP:
return $db->update('xwow_realms', ['realm_stat' => $n['status']], 'realm_name = ?', $n['status']);
 
The error is because you didn't put commas between all of your method arguments.

PHP:
    public function updateRealms($n)
    {
        $db = \XF::db();
        $db->update(
            'xwow_realms',
            [
                'realm_stat'  => $n['status']
            ],
            'realm_name =  ?',
            [$n['name']]
        );
    }
 
Back
Top Bottom