Using IN in createCommand of Yii2 framework

Using IN in createCommand of Yii2 framework

To do this, you should form the query as follows:

Yii::$app -> db -> createCommand() -> update(ContactusModel::tableName(), ['is_read' => 0], [
	'id' => $this -> id
]) -> execute();

Where:
ContactusModel::tableName() — the target table
$this -> id — an array of IDs, which will automatically generate a query with IN (.., .., .....)

Posts on similar topics

Are you having problems with your Yii2 framework website? Do you need additional functionality?
>Then write to me via the feedback form, and I will try to help you.

Write a comment

Your email address will not be published. Required fields are marked *