php - How to get results of findBySQL -


sorry english. here code:

public function showlastthreenews(){     return news::model()->findbysql('select * news limit 3;'); } 

next, example, want results of query:

public function actionindex()     {         $lastnews = $this->showlastthreenews();          foreach ($lastnews $news){             chromephp::log($lastnews->news_title);         }          $this->render('index', array(             'lastnews'=>$lastnews         ));     } 

problem logger show me 1 record 3 times without changing next record.

what mistake?

you using wrong variable in loop change to,

foreach ($lastnews $news){         chromephp::log($news->news_title); } 

Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -