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

Trigger Scheduled Events from Yii2
Iam not getting details from user table
Button click yii2
How to authenticate only email during login in yii2?
$enableCsrfValidation = false
How to add a new column to the gridview in yii2?
How to use bitwise in Yii2
Error 504 gateway time-out
How to limit max char on redactor limiter plugin?
How to use the ArrayHelper::multisort() in Yii2
How to pass parameters from view to controller in Yii2
Automatically cut text on length over limiter?
Can't get the parameter passed from view to controller in Yii2
why functional testing does not require waiting time while acceptance testing requires waiting time codeception
error while creating table using Yii2 migration
my export in yii2 using kartik-v/yii2-export not working

Categories

HOME
client
reserved
json.net
relayjs
fme
alfresco
at-command
analysis
sharepoint-designer
rubygems
binary-tree
yum
communication
spring-xd
gz
commonmark
designer
netflix
windows-7-x64
google-pagespeed
jtextfield
swingx
predix
ehcache
mps
php-openssl
crystal-reports-2010
android-widget
opennlp
javacv
sparse-matrix
buck
vision
google-cloud-nl
preg-match
data-manipulation
http-get
jquery-bootgrid
automake
hockeyapp
particles.js
gzipstream
grid.mvc
fakeiteasy
arena-simulation
reactive-cocoa-5
strptime
pubmed
veracode
rdfs
togetherjs
jxcore
feeds
crypt
font-size
r-forge
epson
sqldf
account-kit
parallel-data-warehouse
heidisql
android-textview
radtreelist
slicknav
adxstudio-portals
mathematica-frontend
dlna
tform
phpcas
vhd
r-tree
teamcity-8.0
quicklisp
tarjans-algorithm
0xdbe
twirl
mono-embedding
system32
lustre
bigbluebutton
formatjs
titanium-modules
internet-connection
terminfo
aapt
funcunit
valueconverter
typo3-neos
centos5
farseer
jelly
android-hardware
free-variable
angularjs-controller
bluepill
getmessage
qtkit
code-cleanup
psi
sudzc
meego
nintendo-ds
private-members
ubuntu-9.04

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
Mobile App
Mobile App
Mobile App