Advertisement
joris

Yii Query

Oct 8th, 2013
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.36 KB | None | 0 0
  1. public function actionIndex()
  2.     {
  3.         $sql = "SELECT * FROM tbl_now_playing e ORDER BY e.id DESC";
  4.        
  5.         $dependency = new CDbCacheDependency('SELECT MAX(update_time) FROM news');
  6.         $rows = Yii::app()->db->cache(10000, $dependency)->createCommand($sql)->queryAll();
  7.  
  8.         $ConvToJSON = CJSON::encode($rows);
  9.         echo '{"items":'. $ConvToJSON .'}';
  10.         Yii::app()->end();
  11.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement