php - can use orWhere and Where functions with delete -
yii2 framework why cant use this?
$rows = new query; $rows->createcommand() ->delete('friends') ->where(['userid' => 1 ,'userid' => 2]) ->orwhere(['userid' => 2 ,'userid' => 1]) ->execute();
in where() , or orwhere() function using hash format (['key'=> 'value'])
hash format hash format best used specify multiple and-concatenated sub-conditions each being simple equality assertion. written array keys column names , values corresponding values columns should be.
lookin code equivalent
userid = 1 , userid = 2
look na useful guide http://www.yiiframework.com/doc-2.0/guide-db-query-builder.html
second important .. in yii2 have delete() , deleteall()
delete() deletes table row corresponding active record.
deleteall() deletes rows in table using provided conditions.
Comments
Post a Comment