Fatal Error Call To A Member Function Findall() On A Non-Object In...

HI guys, i am new here.

I am new to YII , and I just got problem .

I am creating a dropdownlist in my form at view , the data in dropdownlist retrieved from database.

I am using this code


<div class="row">

 <?php

  echo CHtml::activeLabel($model,'Kategori');

 ?>

    

    <?php

  echo CHtml::activeDropDownList(

  $model,'id_kategori',

  CHtml::listData($model->FindAll(),

  'id_kategori','nama_kategori'),

  array('empty'=>'--pilih kategori--'));

 ?>

</div>

But I got this error message : "fatal error call to a member function findall() on a non-object in blablabla…"

What did i have done wrong ? I am very stuck here, I really need help from u guys :)

Thanks.

The variable $model you have passed to the view is not an object.

What is the code of you controller action?

I have already figured out this problem ,

my shame… I must declare the object first.

Hehe thanks btw :D