Q:

SQLSTATE[HY000]: General error after execute query

My update query sets the correct value but returns the following error in Yii2:
Error:
SQLSTATE[HY000]: General error
Update query:
$query =Yii::$app->db
        ->createCommand('
    UPDATE fc_dore_reg 
    INNER JOIN fc_dore ON fc_dore.id = fc_dore_reg.dore_id SET fc_dore_reg.pay_all = 1 
    WHERE fc_dore_reg.user_id = "'.$user_id.'"
')->queryAll();

Why is this error occuring when fc_dore_reg.pay_all = 1 is set correctly?

A:

You should use execute()
Yii::$app->db
        ->createCommand('
            UPDATE fc_dore_reg 
            INNER JOIN fc_dore ON fc_dore.id = fc_dore_reg.dore_id 
            SET fc_dore_reg.pay_all = 1 
            WHERE fc_dore_reg.user_id = "'.$user_id.'"')
        ->execute();

Remember that queryAll() Executes the SQL statement and returns ALL rows at once but there are no rows  to return in an update .. 

