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

Custom Yii2 validator not firing
yii2 send data in another view and save in this view with button
Yii2 assets bundle max folder size limit
Finding where values come to the $model
Call to undefined function tests\codeception\unit\models\expect()
Filter gridview in form in Yii2
rest yii2 pretty url urlManager
Yii2 Checkbox field cannot be checked
How to remove summary in yii2 grid but keeping pager
Having issues with setting up yii2 basic framework and ibm bluemix
Yii2: Non-Scenario fields are not saved
http 403 exception not displaying properly
How to integrate AdminLTE into Yii2 Basic in manual way
Kartik Gridview conflict with my templates menu
YII2 - Mail always saved as files but not sent despite useFileTransport=false
Yii2 Http cache expiress return not match with config

Categories

HOME
ibm-bluemix
winforms
image
netbeans
smarty
hp-exstream
yarn
jgroups
v8
node-notifier
contact
session-variables
kibana-4
gnupg
fancybox-3
modelica
decimal
dosgi
opentracing
telephony
reactive-cocoa
pythonanywhere
predix
orleans
arabic
css-animations
zurb-foundation-6
dxf
rundeck
underflow
spark-jobserver
pingfederate
filezilla
librato
socialengine
junit5
kendo-ui-grid
textmate
appfabric
main
dosbox
xcode-extension
android-browser
document.write
reportingservices-2005
estimote
logfiles
xml-documentation
smartcontracts
upstart
errordocument
rails-routing
powercli
setter
libusb-win32
pillow
sqldf
imanage
chord-diagram
watchconnectivity
visual-c++-2008
database-optimization
underscore.js-templating
hill-climbing
xpath-1.0
jmeter-maven-plugin
fouc
iis-arr
muse
clipperlib
kineticjs
offloading
codeigniter-url
cdt
code-access-security
php-5.4
tld
picturefill
jboss-weld
android-2.2-froyo
oracle-warehouse-builder
fmod
eclipse-memory-analyzer
qt-faststart
xamlparseexception
referrer
online-compilation
amazon-appstore
cufon
stage
xfbml
gallio
web-application-design
.nettiers
photoshop-cs4
eqatec
w3wp

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