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

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -