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

Object of class Closure could not be converted to string
Yii2 check if user is loggedin in yii2
Can not use composer for installing amnah user for yii2
What happens if we reuse “yii init” in same project folder
How to request data used post method from a simple html page to yii2 applicaion
Display time based on country in yii2
How to deleteAll() records which has a foreign key relationship with other table
How to save selected data from checkbox to database
How fix formatter spellot
Conditional validation if input field is empty or not?
Remove Dollar sign from Column value(Indian Currency) Yii2 kartik gridview
upload html input file in yii2
how to run action of frontend controller from backend in yii2
SqlDataProvider filter
Button in gridview yii2
Yii2 doesn't send cookies, with twig extension

Categories

HOME
wso2
vbscript
hook
keras
octobercms
webstorm
rsync
fsm
ckeditor
fancybox
swagger-ui
node-notifier
vifm
spring-kafka
rascal
etl
resize
spring-tool-suite
size
static-libraries
windows-server-2012
caml
ef-migrations
google-static-maps
flux
nhibernate-envers
google-pagespeed
scriptcs
extjs5
cultureinfo
trading
javacv
django-storage
status
intel-pin
windows-error-reporting
applozic
atlassian-crucible
webkitspeechrecognition
vision
semantic-versioning
siesta-swift
fog
uiswipegesturerecognizer
vxworks
hot-module-replacement
withings
starteam
xenforo
uft-api
opshub
trim
g-code
qcombobox
google-datalayer
dotcover
osx-mavericks
parentheses
gabor-filter
nstextview
knockout-components
pg-dump
mako
crosswalk-runtime
quartz-composer
xcb
grails-tomcat-plugin
slicknav
measures
thrust
xml-attribute
plottable.js
gstreamer-0.10
skype4py
qcustomplot
bluegiga
goose
system.management
eclipse-clp
mutation-observers
retina
php-ci
splash
web-controls
pretty-print
umbraco6
csquery
preferences
elliptic-curve
app42
.aspxauth
quartz-graphics
opcache
android-hardware
selected
anonymous-methods
trusted
chrono
hgsubversion
custom-backend
php-parser
mod-auth
coda-slider
premature-optimization
zend-decorators
spec#
msdev
rtml

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