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 full calendar custom button?
can't solve 'date' validation with 'max', 'min' properties Yii2
how can i set to page 1 in pagination when i search in gridview in yii2
Using ArrayHelper in view file in Yii2
Uploading Image and Text on the same submit IN YII2
how can I get a value, not key from dropDownList Yii2 [closed]
How to test a REQUEST GET in Acceptance Test
Codeception radio button list
css is not working after uploading the file on server with filezilla
Is Yii2 compatible with PHP 7?
Class 'yii2fullcalendar\models\Event' not found
Allow to get POST data from outter server YII2
Yii2 - How to update textInput Value from DropDownList
Model validate date format
sjaakp/yii2-illustrated-behavior Yii2 extension for image not being saved
Issue In Bootstrap Modal

Categories

HOME
compiler-construction
yii2
c#-4.0
layout
iterator
cvs
yarn
binary-tree
angular-ui-bootstrap
ojdbc
synchronization
amazon-cloudformation
windows-10-universal
izpack
imacros
modelica
nstableview
postgres-xl
phaser
quickfix
uitypeeditor
jprofiler
plunker
swiftlint
tapestry
google-search-api
restful-authentication
microsoft-sync-framework
javacv
centos6.5
fgetcsv
nhapi
replaceall
bpel
flink-streaming
airconsole
android-kernel
amazon-kinesis-kpl
mapdb
jmonkeyengine
overlap
appfabric
theano.scan
leading-zero
cookiecutter-django
hp-ux
dynamic-reports
outlook-api
reactive-cocoa-5
.net-4.6.2
websphere-mq-fte
taffy
dotcover
apache-fop
jquery-nestable
boost-multi-index
togetherjs
gabor-filter
svmlight
google-perftools
flow-control
gcsfuse
ableton-live
static-ip-address
instant
dstu2-fhir
py2app
qcustomplot
hover-over
hexdump
nessus
php-internals
maven-tomcat-plugin
computer-algebra-systems
inmobi
device-orientation
umbraco6
formatjs
oxwall
asp.net-dynamic-data
issuu
php-5.4
terminfo
project-planning
article
dml
poller
jboss-weld
android-2.2-froyo
pyhdf
mysqltuner
page-layout
dotnetnuke-5
eclipse-memory-analyzer
shellexecute
gwt-rpc
xamlparseexception
plasma
funscript
gdata-api
window-management
rfc1123
celltable
html-input
site.master
h.323
jquery-ui-droppable
boost-smart-ptr
aquaticprime
sector
ugc
django-notification

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile