lz19881123 2012-01-05 10:33:52 2813次浏览 2条回复 0 0 0
$criteria=new CDbCriteria();
$criteria->select='news_title,username,pl_id,pl_content,pl_time';
$criteria->join='JOIN pinglun ON news_id =pl_int  JOIN users ON id=pl_person'; 
$criteria->order='pl_id DESC';          
$dataProvider = new CActiveDataProvider('News',array( 'pagination'=>array( 'pageSize'=>8)));
$this->render('index',array(
    'dataProvider'=>$dataProvider,
));
  • 回复于 2012-01-05 10:36 举报
    $sql="select pl_id,pl_content,pl_time,news_title,username from news join pinglun on news_id=pinglun.pl_int left join users on id=pl_person order by pl_id desc";
    $art=Yii::app()->db->createCommand($sql);
    $data=$art->queryAll();
    $dataProvider = new CActiveDataProvider($data);
    

    这种写法对吗?

  • 回复于 2012-01-05 10:36 举报

    请老鸟看看!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!:lol

您需要登录后才可以回复。登录 | 立即注册