Yii Framework Forum: How To Use Active Records Update Method - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

How To Use Active Records Update Method Rate Topic: -----

#1 User is offline   RuliTheHat 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 10
  • Joined: 25-May 12

Posted 16 November 2012 - 07:16 AM

I would like to try active record and its update feature.
Here's my query:

UPDATE bau, test
SET basisname = test.text
WHERE bau.process_1_ID = test.p_1_ID
AND bau.process_2_ID = test.p_2_ID
AND bau.process_3_ID = test.p_3_ID
AND bau.ee_ID = 0;


Please someone tell me how to put condition and other parametres
0

#2 User is offline   KonApaz 

  • Elite Member
  • PipPipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,317
  • Joined: 21-February 11
  • Location:Greece

Posted 16 November 2012 - 09:31 AM

Hi RuliTheHat

YourClass::model()->updateByPk($pk,$attributes,$condition,$params);

where condition

$criteria=new CDbCriteria;
$criteria->addCondition('field1=:value1');
$criteria->params=array(':value1'=>10);
...
...
etc
Yii is the best php framework in the world!
find our demo Yii extension on www.webkit.gr
Is it post useful? please v++ ;)
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users