时间:2021-07-01 10:21:17 帮助过:2人阅读
删除数据:
Yii::app()->db->createCommand()->delete(‘es_users‘, ‘id=:id‘, array(‘:id‘=>2));
|
更新数据:
$res = Yii::app()->db->createCommand()->update(‘es_users‘, array(‘name‘=>‘局外人‘), ‘id=:id‘,array(‘:id‘=>2));
|
查询数据:
查询一条记录
$row = Yii::app()->db->createCommand()->from(‘es_user‘)->where(‘id=:id‘,array(‘:id‘=>2))->queryRow();
|
查询符合条件的多条记录:
Yii::app()->db->createCommand()->select(‘id,name,email‘)->from(‘es_user‘)->where(‘id>:id and id<5‘,array(‘:id‘=>1))->queryAll();
YII 数据库操作之DAO
标签: