How to use model()->getAttributes()?

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

If you check the documentation at http://www.yiiframework.com/doc/api/CModel#getAttributes-detail

will see that you need to pass an array

so use something like


$names = User::model()->getAttributes(array('name'));