Pull data from DB to view

Hi all

I have a Employee DB Table,This Employee DB Table containing three DB Columns(eid.ename,eaddress).I want to display the data of Employee table in my View part.Please tell me the procedure.

any help will be highly appreciated

Create a model for Emlpoyee, retrive the employe in a controller with:




$employee=Emlpoyee::model()->findByPk();



For example. Pass it to the view:




$this->render('view', array('employee'=>$employee));



Now in the view you can display your fields:


<?php echo $employee->ename?>

hi zaccaria

Thanks a lot

can u tell me how can i create model for pull data from db ?

and I want to show the empolyee data in grid view…Pls tell me the step…

have you tried the Yii Blog Tutorial or even searched in the documentation??

try these links:

http://www.yiiframework.com/doc/blog/

http://www.yiiframework.com/doc/guide/1.1/en/database.ar