标签:yii insert update delete queryall
//添加
Yii::app()->db->createCommand()->insert(‘tbl_user‘,
array(
‘username‘ => ‘zhangsan‘,
‘email‘ => ‘zhangsan@zs.com‘));
//修改
Yii::app()->db->createCommand()->update(‘tbl_user‘,
array(
‘username‘ => ‘Tester‘), ‘id=:id‘, array(
‘:id‘ => 3));
//删除
Yii::app()->db->createCommand()->delete(‘tbl_user‘, ‘id=:id‘,
array(
‘:id‘ => 2));
//查询
$users = Yii::app()->db->createCommand()
->select(‘*‘)
->from(‘tbl_user‘)
->queryAll();
var_dump($users);
标签:yii insert update delete queryall
原文地址:http://jinliang.blog.51cto.com/8981814/1618025