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
hook
zeromq
mean-stack
framework7
kalman-filter
getelementsbytagname
maven-3
jxls
windows-server
acquia
podio
esper
rascal
jplayer
dynamics-crm-online
worldwind
graphlab
dbext
cx-freeze
graphicsmagick
sox
realex-payments-api
language-agnostic
cultureinfo
trading
jspm
vision
instant-messaging
siesta-swift
catel
http-referer
environment-modules
sequential
overlap
jquery-bootgrid
libvpx
streamsets
c11
bootstrapper
awt
google-closure
businessworks
taffy
rainbowtable
dandelion
hls.js
recursive-datastructures
diagnostics
kbuild
jspdf-autotable
parallel-data-warehouse
android-fonts
elements
multiple-regression
master-slave
livequery
ios4
rhino-servicebus
r-tree
computer-algebra-systems
security-testing
deis
myo
sailfish-os
census
tween
tablelayout
phalanger
xojo
monomac
selected
bluepill
manchester-syntax
newtonscript
osql
blackberry-playbook
hamachi
sql-server-profiler
fluent-interface
blitz++
infrastructure
sproutcore-2
routedevent
castle-monorail
w3wp

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile