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 / Migration Not Working
Kartik GridView Yii2 : Toggle data not working in toolbar
yii2 http client request and repsponse
How to insert multiple times the value of an attribute in single table in yii2
yii2 SluggableBehavior is applied to only emty slug field
Yii2: Create path and url for folder inside a module
Disable ActiveForm Clientside Validation on button other than submit Yii2
CRUD view link does not work in Yii2
Yii2 DynamicForm: Demo 3: Nested Dynamic Form with types of rooms
Company Follow Button disappear after login popup - Linkedin issue
How do I get rid of composer-asset-plugin in yii2
Yii2 Can not Store huge integer
Yii2 flash messages rendered automatically
Foreign Keys in yii2.0
ActiveForm doesn't submitting after clicking submit Yii2
Does Yii2 AR class can check, does two objects has a link?

Categories

HOME
winforms
jdo
pypi
gerrit
debugging
netsuite
urbancode
drivers
pycharm
iot
paw-app
rubygems
gps
ckeditor
uber-api
phaser
serverless-framework
worldwind
evopdf
swingx
virtualdub
maxmind
fluentvalidation
opentype
large-file-upload
preg-match
yadcf
twilio-api
atl
revolution-slider
devextreme
adobe-premiere
serve
reactive-cocoa-5
.net-4.6.2
menuitem
flickr-api
azure-application-gateway
python-c-api
dandelion
winscp-net
nsarray
dtexec
objective-c-swift-bridge
yt-project
jquery-filter
log4c
elements
intrusion-detection
ctest
player
sdf
pickadate
hexdump
associative-array
pyke
qtableview
endeca-workbench
jmeter-maven-plugin
iis-arr
quicklisp
method-parameters
event-bubbling
operation
jsapi
kineticjs
dia
jscript.net
coldbox
java-metro-framework
googlemock
bitcoinj
ceil
fluentautomation
system.net.webexception
centos5
terminal-services
blending
coverflow
eclipse-memory-analyzer
random-seed
orchardcms-1.7
html-editor
pvrtc
path-separator
coderush
viewswitcher
buildr
custom-backend
heartbeat
thunderbird-lightning
javap
spec#

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