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

Using implode in gridview yii2
How to upload same file in different folder?
Yii2 change redactor box size
How to search using SearchModel in Yii2?
negation in query condition yii2
yii2 General SQL Server error: Check messages from the SQL Server [208] (severity 16) [(null)]
Yii2 Summernote widget not working
yii2 bootstrap Nav keep parent active when child pointing to different module
Generate data-confirm not working
yii2 check database type (mysql or oracle)
Installing Yii2 - 403 Forbidden page
Data from two function in one column in gridview yii2
Write info message in app.log file using yii2
Add conditions in view, wich will get in sql query
Yii2 gridview: sending attribute value to filter
Count of each status in gridview yii2

Categories

HOME
wso2-am
server
comparison
iterator
objectgears
react-router
infragistics
icloud
convolution
virtualization
static-libraries
event-handling
circuit
decomposition
highlight.js
transformation
http-status-code-504
undefined
oxyplot
excel-vba-mac
tibco-mdm
rundeck
angular2-aot
one-to-many
brunch
virtualdub
maxmind
neo4j-spatial
skia
react-chartjs
junit5
javascriptcore
yadcf
google-cloud-endpoints-v2
textmate
bower-install
jmonkeyengine
dartium
serve
lto
libraries
unspecified
cookiecutter-django
jvm-languages
no-www
midl
angular2-meteor
outlook-2013
strptime
paxos
hls.js
darcs
lift-json
android-cursor
linode
dwscript
smart-table
or-tools
messenger
medium.com
jquery-filter
setuptools
elements
database-optimization
mikroc
autorest
gridview-sorting
fadeout
yaws
captivenetwork
ios4
ptrace
asp.net5
execute
google-places
angular-leaflet-directive
responsive-images
service-accounts
arcanist
operation
jsapi
titanium-modules
htmlcleaner
seaside
jboss-weld
prettify
dir
tidy
odata4j
sharp-repository
e4x
bitsharp
netbeans-6.9
buildr
nsobject
android-sdk-2.1
sql-server-profiler
wise
revisions
mozilla-prism
kdbg
ti-dsp
rtml

Resources

Encrypt Message