Yii Framework Forum: How to use model()->getAttributes()? - 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 model()->getAttributes()? Rate Topic: -----

#1 User is offline   tq0fqeu 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 9
  • Joined: 06-May 10

Posted 14 May 2010 - 01:45 AM

How to use model()->getAttributes()?
I do like this
//User table is not null, but $names is null
$names = User::model()->getAttributes('name'); 

pls give me a example
0

#2 User is offline   Maurizio Domba Cerin 

  • Yii - Yesss It Is !!!
  • Yii
  • Group: Yii Dev Team
  • Posts: 4,359
  • Joined: 12-October 09
  • Location:Croatia

Posted 14 May 2010 - 02:46 AM

If you check the documentation at http://www.yiiframew...tributes-detail
will see that you need to pass an array

so use something like
$names = User::model()->getAttributes(array('name')); 

Find more about me.... btw. Do you know your WAN IP?
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