Save Model

hi

I need to save model from another controller. I used following code but it is not saving changes in database.




class FeePaidBulkController extends Controller

{

...

public function actionDoBulkPayment() {

 FeePaid::model()->student_id=$iStudentId;

 FeePaid::model()->fee_structure_id=$iFeeStructureId;

 if(FeePaid::model()->save())	{

 }

}

...

}


class FeepaidController extends Controller

{

....

}



create a new instance of the FeePaid like so


<?php


class FeePaidBulkController extends Controller

{

	public function actionDoBulkPayment() {

		$feePaid = new FeePaid;

		$feePaid->student_id=$iStudentId;

		$feePaid->fee_structure_id=$iFeeStructureId;

		if($feePaid->save()){

			// do stuff ...

		}

 	}


}

Thanks alirz23. I was not creating instance of model thats why it was not saving in db.