db\Command update()

update() public method

Creates an UPDATE command.

For example,

$connection->createCommand()->update('user', ['status' => 1], 'age > 30')->execute();

The method will properly escape the column names and bind the values to be updated.

Note that the created command is not executed until execute() is called.

public $this update ( $table, $columns, $condition = '', $params = [] )
$table string

The table to be updated.

$columns array

The column data (name => value) to be updated.

$condition string|array

The condition that will be put in the WHERE part. Please refer to yii\db\Query::where() on how to specify condition.

$params array

The parameters to be bound to the command

return $this

The command object itself

doc_Yii
2016-10-30 16:57:33
Comments
Leave a Comment

Please login to continue.