Question and answer is powered by AnsPress.io
Form the MySQL table I want to get register data by register name order by Ascending. I am using Cakephp, how can I select register name Order BY Ascending?
I’ve followed this code:
$Register = $this->Register->find('list', array('fields' => array('Register.id', 'Register.name')));
Use ‘order’ => array(‘Register.name’ => ‘ASC’) to select data Order BY Ascending in Cakephp.
Apply this code:
$Register = $this->Register->find('list', array( 'fields' => array('Register.id', 'Register.name'), 'order' => array('Register.name' => 'ASC') ));