yii2


Yii2 update with multiple conditions


$this->localdb->createCommand()
->update(
$this->MYTable,
[
'name' => $el['new'],
'data' => $el['data'],
],
[
'userId', $this->user,
'product_id', $this->productId,
'name', $el['old'],
'created', $el['date'],
'category', $el['cat'],
]
);
I tried to use the following command to update a row using multiple where conditions, but it doesn't work for some reason. The documentation doesn't seem to cover this case and doesn't seem to be updated, because the update() method seems to match the updateAll method instead of the update method for some reason (maybe it was updated?). So I was wondering what was the correct way to do this.
You have a syntax error. Try following:
$this->localdb->createCommand()
->update(
$this->MYTable,
[
'name' => $el['new'],
'data' => $el['data'],
],
[
'userId' => $this->user,
'product_id' => $this->productId,
'name' => $el['old'],
'created' => $el['date'],
'category' => $el['cat'],
]
);

Related Links

yii2 DatePicker widget error
Filter data with kartik Select2 widget in gridview
Create behavior in yii2
Yii2 restricting access to RBAC Module itself
Steps to send mail using sendgrid mailer function in yii2?
Cannot install packages via composer in yii2
Yii2 Browser Popup Window Layout duplicating
Yii2 When Validation
How to exclude rendering existing script in DOM in Yii2
Issues with yii2-advanced functional tests
Yii2 get post request value not working
Getting unknown property: frontend\modules\printinvoice\models\Prodfin::productcode
Google recaptcha validation in yii2 always fails
Yii2 ActiveFormAsset dependencies
Chat in Yii2 is not working
Yii2 theme baseurl

Categories

HOME
minimum-spanning-tree
mockito
path-finding
fme
mean-stack
getelementsbytagname
elm
angular-ui-bootstrap
datastax-java-driver
azure-media-services
contact
maude-system
user-input
spring-xd
izpack
collectd
decimal
serverless-framework
angular-ui
nhibernate-envers
samoa
textfield
nodatime
mps
excel-2007
jndi
blazemeter
fluentvalidation
jaxb2
subdomains
tasklet
file-rename
iframe-resizer
overlap
vxworks
event-driven
withings
sqlite2
document.write
angularjs-factory
import-from-excel
wptoolkit
jsch
komodoedit
promela
paxos
elgg
arrow-keys
crosswalk-runtime
topbeat
pycaffe
root-framework
static-ip-address
heidisql
grails-tomcat-plugin
android-textview
autorest
ready-api
make-install
php-internals
rtbkit
prerequisites
jms2
teamcity-8.0
wireshark-dissector
drawbitmap
graph-drawing
operation
unity3d-gui
unity5.2.3
notify
npapi
python-green
java.util.concurrent
websocket4net
html-helper
mesa
heisenbug
picturefill
ember-charts
multiprocessor
jmapviewer
batterylevel
dataadapter
smtp-auth
cassini-dev
kyotocabinet
gil
cascalog
wse3.0
netbeans-6.9
dotnethighcharts
bigcouch
gnustep
hirefire
vdsp
gcj
xdomainrequest
netbeans-7.1
winbugs14
dbal
uimenucontroller
avatar
yagni
noscript
dbisam

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html