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 use runAction() within beforeAction method
Yii2-user, dektrium-yii2-user, Yii2 Populate a dropdown in yii2
Yii2: How to start an export programmatically
Getting field value in controller
display setFlash on spesific div
Yii 2 vendor trouble
Yii2 - module login in basic application template
Yii2 and sqldataprovider in inner query, write one aggregating expression per reporting column, 2. In an outer query, build the horizontal sums
Yii2. What is the best practice to manage new messages?
How to load jquery files on header in Yii2?
Getting (not set) when joining a column which has a sum function in yii2
Time is wrong when get datetime in yii2
Yii2 get app web url without index.php
How to get max and min date in Yii 2
How can I Implement HTTPS for all pages Yii2
Yii2 RBAC Rule Feedback / Message

Categories

HOME
sendgrid
ionic-framework
webpack
minimum-spanning-tree
kde
office365api
react-router
alfresco
youtube-dl
bookshelf.js
ip
callback
ojdbc
yum
flyway4
append
gnupg
adobe-analytics
here-api
spring-tool-suite
phaser
quickfix
hapi
openrefine
pc
propel
oracle-coherence
lldb
autocad-plugin
kvc
devops
wijmo
vlsi
fish
facet
internet-explorer-9
uninstall
greendao
replaceall
saas
jspm
google-rich-snippets
galsim
data-manipulation
hybridauth
http-referer
hexo
android-ble
restlet
android-browser
unspecified
android-fingerprint-api
trim
gulp-sourcemaps
s
xml-documentation
scrollable
smartcontracts
react-scripts
qsslsocket
blogengine.net
winscp-net
git-diff
setter
typed-lambda-calculus
google-perftools
yt-project
azure-sdk
httplistener
infix-notation
slicknav
django-debug-toolbar
paypal-express
persist
ready-api
dlna
energy
r-tree
prerequisites
coveralls
rgeo
myo
event-bubbling
census
skos
csquery
typekit
gadt
javafx-webengine
xcode-6.2
internet-connection
neolane
document-classification
fluentautomation
phpthumb
wp-query
srs
blending
batterylevel
random-seed
xamlparseexception
limejs
angularjs-controller
coderush
automount
cascalog
javaspaces
appconkit
spring-portlet-mvc
libc++
window-management
joyent
f#-powerpack
file-comparison
gin
audio-capture
ctp4
uimenucontroller
noscript
thread-local-storage
msdev
data-acquisition

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