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,I want to change my url like “aaaa.bbbb.cccc.dddd/app/web” to any name like “example.com” .How can I achieve this
Yii2 create audit record by passing old and newly updated record and comparing the data
Email on Yii2 Advanced
yii2 getting data from two models and presenting it in view
Yii2 captcha image is not displaying
How do you set a textInput to readOnly in Yii2?
Yii2 call another action from my view
How to get auto increment id after save in Yii2
Bitbucket Pipelines config for yii2. Need github token
yii2 switch button that render page with pjax
Pagination position in Yii2
Handling Yii2 in tabular input
Yii2 pass query result to a action in another controller
Same project gets error in other system Yii2
PHP Yii2 framework run multiple websites using single core code and one server
Calculate average from kartik gridview(YII2)

Categories

HOME
ms-access
sendgrid
log4j
lodash
iot
wamp
azure-media-services
multiple-records
correlation
resize
zend-framework3
django-simple-history
footer
functional-testing
facebook-instant-articles
telerik-reporting
mmap
p-value
strncpy
bluestacks
siesta-swift
geopositioning
nssegmentedcontrol
overlap
libraries
theano.scan
babel-core
avconv
rails-routing
logparser
alphabet
powercli
lift-json
jspdf-autotable
bind9
crosswalk-runtime
smart-table
setuptools
removechild
url-masking
adxstudio-portals
login-control
django-debug-toolbar
prettytensor
qgraphicsview
dataview
ios8-today-widget
marching-cubes
sniffer
census
dundas
android-imagebutton
client-side-templating
wp-query
marmalade
picturefill
concurrent-collections
mcts
industrial
flexmojos
geos
easy-install
buster.js
xamlparseexception
plasma
limejs
eventlistener
kyotocabinet
tinn-r
isnullorempty
trusted
propertyeditor
ocx
xtype
locationlistener
telerik-scheduler
digest-authentication
mozilla-prism
routedevent
exchange-server-2003
ctp4
sector
wsdl.exe

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