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 Browser Popup Window Layout duplicating
Yii2 When Validation
How to exclude rendering existing script in DOM in Yii2
Issues with yii2-advanced functional tests
Yii2 get post request value not working
Getting unknown property: frontend\modules\printinvoice\models\Prodfin::productcode
Google recaptcha validation in yii2 always fails
Yii2 ActiveFormAsset dependencies
Chat in Yii2 is not working
Yii2 theme baseurl
Accessing the table fields with relation yii2
Matrix Report in Yii2
Error in wbranca dynagrid update
Can't install Yii2 via Composer
SelectizeTextInput - page jumps when loading query in ajax results
Yii2. Represent an image.

Categories

HOME
openlayers
webpack
reflection
minimum-spanning-tree
kalman-filter
getelementsbytagname
sqlite-net-extensions
wamp
mouse
azure-storage-tables
webrequest
basic
elasticsearch-hadoop
windows-10-universal
node-pdfkit
quicklook
nstableview
circular-dependency
commonmark
leiningen
database-replication
evopdf
scichart
ml
tokenize
jndi
icloud-api
buildbot
wpfdatagrid
nhapi
saas
dbclient
gitignore
file-rename
nameservers
binary-data
http-status-code-503
pim
openoffice.org
xmlreader
force-layout
environment-modules
git-merge
webdriver-manager
angularjs-factory
particles.js
dynamic-reports
quadratic-programming
eigenvalue
vao
http-redirect
filepicker
pubmed
hls.js
aurelia-validation
vtigercrm
synchronous
migradoc
setuptools
savon
azure-virtual-network
nsfilemanager
mathematica-frontend
lttng
blackberry-10
actionbardrawertoggle
design-by-contract
tform
natvis
iad
tmuxinator
spidermonkey
citrus-pay
security-testing
deis
tableau-online
system32
geonetwork
android-nested-fragment
android-imagebutton
fpml
preferences
valueconverter
htmlcleaner
oracle-warehouse-builder
algebraic-data-types
stxxl
intentservice
ruby-datamapper
cos
yui-compressor
bitsharp
asyncfileupload
php-parser
floating
google-friend-connect
routedevent
thunderbird-lightning
zune
ubuntu-9.04
.net-1.0

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