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 extension: How to declare $sourcePath in assets?
Yii2 Mailchimp Integration
Unable to save model attribute as null?
How to add a placeholder to a dropdown in Yii2?
How to use a custom Controller in yii2?
How to disable one prompt value in yii2 drop-down?
How to set swiftmailer setFrom() to show name and surname instead of email? Yii2
Reflection Exception error caused while using a extension in yii2
use barebone Yii2 framework
yii2 rest api basic auth throws 401 unauthorized
How can I directly go to an action in the browser?
Yii2 - drag and drop file upload with widget kartik-v [closed]
yii2 dectrium rbac rule validation class does not exist
access a models component included relation tha result with another models yii2
Yii2 how can an model attribute is modified after load method? (like the afterFind method)
How to disable Create button to prevent multiple times the data to be saved in database in yii2

Categories

HOME
pypi
keras
openstack
reserved
onedrive
vmware
q
sqlite-net-extensions
sharepoint-designer
c#-2.0
disassembler
ebean
mvvmcross
opengl-es-2.0
datastax-java-driver
google-cloud-spanner
zend-framework3
php-7.1
dtrace
netflix
iolanguage
libtiff
tostring
footer
normalizr
beyondcompare
emulator
predix
immutable.js
jasonette
mmap
trading
phpfox
fopen
typo3-6.2.x
compatibility
windowbuilder
nameservers
key-value-observing
column-family
http-referer
wpf-controls
plsql-psp
restlet
uft-api
squib
jvm-languages
fakeiteasy
total-commander
sas-jmp
wso2carbon
youcompleteme
chain-builder
svmlight
directory-structure
sqlbulkcopy
pillow
hittest
abcpdf9
gridpane
rotativa
savon
skobbler-maps
gridview-sorting
persist
sdf
dataview
tform
lemon
marching-cubes
dundas
c++03
umbraco6
bigbluebutton
dia
winddk
qcodo
preferences
xojo
xceed-datagrid
jboss-weld
typo3-neos
viadeo
mcts
flash-builder4.5
smtp-auth
http-unit
clipper
path-separator
gdata-api
tridion-worldserver
ocx
code-cleanup
transactionscope
fireworks
gwt-ext
ecl
h.323
nintendo-ds
virtual-functions
swing-app-framework
nerddinner
windows-live-messenger

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile