Comparing
#1 with
#2
Yii version
1.1
Tags
database,cdbcriteria, database, CRUD
Content
[...]
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.
### Create
```php
**// to save all the paramerters of the post request**
$model = new Model;[...]
### Update
```php
// to update the the whole parameters
$model = new Model;[...]
### Delete
```php
Model::model()->deleteAll(array('condition' => 'id=:io','params' => array('io' => $_POST['id'])));
```[...]
```php
// in model
$criteria=new CDbCriteria;
$criteria->compare('status',$this->status,true);
$criteria->compare('name',$this->name,true);
**// if you want to select a few fields the use the following[...]