CRUD operation in Yii framework

Simple Yii Script for performing CRUD operations:

Greetings, This tutorial teach you the simple way to perform the crud operation in Yii framework, its easy to perform the database operation in Yii. Here we are going to see the create, update, delete and select scripts that required in almost all the applications.

**// to save all the paramerters of the post request**
  $model = new Model;

**// to save parameters with changes before creation**
  $model = new Model;
**// here name will concatenate both first and last names**

// to update the the whole parameters 
  $model = new Model;
// the form that already maps the id with value

// to update few parameters
**// Model::model()->updateAll(array($parameters),$conditions);**
 Model::model()->updateAll(array('name' => $_POST['name']),'id="'.$POST['id'] );
Model::model()->deleteAll(array('condition' => 'id=:io','params' => array('io' => $_POST['id'])));
// in model
$criteria=new CDbCriteria;
**// if you want to select a few fields the use the following
// other wise ignore this you will get all the records**
return new CActiveDataProvider($this, array('criteria'=>$criteria));

// in controller
$model=new Currency('search');

For more Related information regarding the active records Visit :