Process Writing With Yii

Hello friend…

I need to retriev data from the database table and do some calculation and view the result.

Can anyone give me tha idea that how di I do it in proper way with example.calculation something like salary calculation of employement.

pls give me your opinion.

Thank you

I believe in asking the database for what you want.

IE, do the heavy lifting on the SQL end of things. Why don’t you post same samples of your DB structure and what you are trying to get.

I have the mysql table in following way.

I need to get


x=paymentper othour;

then I need to display total salary in each of the employee separately in their view file…

How do i do it in proper way pls give me more instruction with sample coding…

thank you

PLS HELP ME … IAm totally new to yii.this is really important to me.

How do I start.hrlp me.thank you.

Perhaps you should buy a book about Yii?

Sounds like the most cost effective way of getting your Yii programming off the ground.

If not, now would be a good time to start putting some effort into it. Instead of asking that people walk you through it.

good Idea.Thank tou

I would create a dynamic attribute in the model

public $totalSalary;

Next I would override the afterFind method

public function afterFind()


$this->totalSalary = (($this->basicSalary + $this->allowance + $this->OTHour) * $this->X);

return parent::afterFind();


Now your totalSalary property will always contain this calculation after a search.

Actually I really need to know that the contribution of model views and controller to solve the problem like that.thank you

Is it behoove that the calculation method write in controller. Can we write that function in model.pls tell me. I want to knw the contribution of model view and controller to solve the problem …pls help me.I need to get the clear idea. thank you

Have you read the definitive guide to Yii?

If not, you really should. It’s great read. It explains very well the conventions and gives an overview of how controllers, models and views relate to each other.

hmmm thank you…

pls Can anyone guide me.can anyone please give an idea or any tutorial,

If there have any other tutorials regarding above problem pls send me the url. thank you

If there have any other tutorials regarding above problem pls send me the url. thank you