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

Leaflet extension and Geosearch Directory not found
Yii2 - how to access html files in root folder?
Validate unique value from database in Yii2
Yii2 strtoupper() expects parameter 1 to be string, array given
show each pjax link into each special div
How to give hidden input value to dynamic form fields yii2
Yii2 prettyUrl doesn't work
what a part does bower/bower-asset play in php application such as yii2
Yii2 : how to use deleteAll with two conditions = and NOT IN
Displaying attribute labels instead of attribute names in Yii2 audit trail extension output
yii2 migration, add column, after other one
yii2 ajax form submission: validation response handling
How to create custom column in Yii2 grid view by using other table value
Yii2 - Image upload and resizing,ajax upload support extension
Pagination in dataprovider is not working properly yii2
Dependent fields yii2

Categories

HOME
tinymce
relative-path
onedrive
octobercms
cvs
append
slick-slider
windows-10-universal
offline
handsontable
commonmark
dtrace
hapi
netflix
django-simple-history
transformation
text-rendering
nhibernate-envers
bootstrap-tour
hammerspoon
firebase-crash-reporting
h2db
user-interaction
info.plist
greendao
flink-streaming
skia
lightswitch-2013
junit5
ecto
semantic-versioning
noraui
catch-all
usbserial
appfabric
bitbucket-pipelines
code-search-engine
mime
import-from-excel
jsch
osx-mavericks
revapi
worksheet
pebble-watch
togetherjs
svmlight
brightcove
lift-json
crypt
libusb-win32
font-size
spring-mongodb
objective-c-swift-bridge
messenger
log4c
slicknav
nsfilemanager
autorest
fputcsv
react-native-listview
sigabrt
python-stackless
packagist
energy
pervasive-sql
apache-commons-fileupload
census
proj4js
bridge.net
inmobi
c++03
bigbluebutton
fscommand
jscript.net
internet-connection
rdl
android-radiobutton
multiprocessor
tidy
ruby-datamapper
mhtml
dmoz
online-compilation
uiviewanimation-curve
php-parser
gnustep
stage
blackberry-playbook
coercion
lang
asp.net-mvc-areas
.nettiers
gin
brewmp
simpletest
nerddinner
w3wp
commodore
paul-graham





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