How To Save Tabular Input To Db?

Hi,

I’ve been working through the tutorial on updating tabular input (http://www.yiiframew…1/en/form.table) and I’ve got the front end part working. I don’t know how to write the controller though so that it saves each model back to the database.

I inserted my best guess below of:

$task->save();

That gets me an error of:

“Property ‘Task.value’ is not defined.”

Please explain how I would go about this. I’m very new to PHP and Yii so please be thorough.

public function actionUpdateBetaTaskList($id)

{

//gets an array of tasks to update

$tasks = Task::model()->findAll(‘bdList=:bdList’, array(’:bdList’=>1));

if(isset($_POST[‘Task’]))

{

foreach($tasks as $i=>$task)

{

if(isset($_POST[‘Task’][$i]))

$task->attributes=$_POST[‘Task’][$i];

$task->save();

}

$this->redirect(array(‘indexProjects’));

}

$this->render(‘update_tasklist2’,array(

‘tasks’=>$tasks,

));

}

U have some problem in ur table column (value) either in model or db table…

The “save()” method belongs to CActiveRecord, not to CModel, that’s why we cannot save. I am trying to save new data onto my CModel and I don’t know how… I guess I’ll keep looking.