成都网站建设设计

将想法与焦点和您一起共享

Yiimodel的待条件和排序查询

$criteria=new CDbCriteria;   

创新互联主要从事网站设计、做网站、网页设计、企业做网站、公司建网站等业务。立足成都服务双流,十载网站建设经验,价格优惠、服务专业,欢迎来电咨询建站服务:18982081108

$criteria->addCondition("id=:id", "and");

$criteria->params[':id']=$_POST['book_id']; 

$criteria->order = "remove_time desc";

$comments = BooksComments::model()->findAllByAttributes(

array('book_id'=>$_REQUEST["bkid"]), 

$criteria

);

$readhistory = BooksHistory::model()->findAllByAttributes(

array('book_id'=>$_REQUEST["bkid"]),

new CDbCriteria(array("order"=>"borrow_time desc"))

);

$bookwaiting = BooksWaiting::model()->findAllByAttributes(

array('book_id'=>$book_id, 'status'=>array(0,1)),

new CDbCriteria(array("order"=>"id "))// ,"limit"=>"20", "offset"=>"0" // limit 0,20

);

修改:

BooksWaiting::model()->updateAll(

array("status"=>"4", "cancel_time"=>getCurTime()),

"book_id=:book_id and user_id=:user_id", 

array(":book_id"=>$_REQUEST['book_id'], ":user_id"=>RoleUtil::getUser()->nsn_id)

);


网站标题:Yiimodel的待条件和排序查询
网站网址:http://chengdu.cdxwcx.cn/article/pccdcj.html