Wednesday, March 28, 2018

Yii2 update column with query builder

Yii2 also provide update method for update the table records.

In below example we are just updating the single record with where condition.

How to update record in Yii2

Yii::$app->db->createCommand()
             ->update('tblName', ['name' => 'Ram'], ['id'=> 4])
             ->execute();

1 comment:

  1. Really awesome blog. Your blog is really useful for me. Thanks for sharing this informative blog. Keep update your blog.
    Dedicated Yii Framework developers in India

    ReplyDelete

Recent Update

yii2 session handling

use yii\web\Session; $session = Yii::$app->session; // start session $session->open(); // close session $session->close(); ...

Most Search