CakePHPで取得したデータを並び替える(ソートする)
コントローラーに下記のように記述します。
前回と同じく、wimagesというテーブルのデータを全部取得する、という例です。
例:wimagesというテーブルのデータを取得し、id順に表示する
<?php
class WimagesController extends AppController {
var $name = 'Wimages';
function index() {
$this->set('wimages', $this->Wimage->find('all',array('order' => "id")));
}
}
?>
