gpt4 book ai didi

zend-framework - Zend 框架 ORDER BY

转载 作者:行者123 更新时间:2023-12-04 06:52:36 24 4
gpt4 key购买 nike

我有一个我想按字母顺序排序的项目列表,这是我的代码:

public function indexAction()
{
$this->authoriseUser();
$this->view->assign('title', 'Clubs');
$this->view->headTitle($this->view->title, 'PREPEND');
$clubs = new Application_Model_DbTable_Clubs();
$this->view->clubs = $clubs->fetchAll();
$select = $clubs->select();
$select->order('club_name ASC');
}

怎么了?因为它不起作用..

谢谢

最佳答案

您需要将选择对象传递给 fetchAll 方法

public function indexAction()
{
$this->authoriseUser();
$this->view->assign('title', 'Clubs');
$this->view->headTitle($this->view->title, 'PREPEND');
$clubs = new Application_Model_DbTable_Clubs();
$select = $clubs->select()
->order('club_name ASC');
$this->view->clubs = $clubs->fetchAll($select);
}

关于zend-framework - Zend 框架 ORDER BY,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10422173/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com