gpt4 book ai didi

php - 如何根据 codeigniter 中的特定值显示行数

转载 作者:行者123 更新时间:2023-11-30 21:30:52 25 4
gpt4 key购买 nike

<分区>

我正在寻找一种使用 CodeIgniter 根据特定列数据显示行数的解决方案。

这基本上是一个商店注册项目。我有一个名为 shopowner 的数据库表,其中有一列名为 status。而这个 status 列只有 3 个值。 IE。如果状态为0,则记录正在等待批准,一旦批准,状态将变为12表示拒绝。现在在我的仪表板中,我需要显示待处理、已批准和已拒绝记录的总数。谁能帮我解决这个问题,请告诉我在模型、 Controller 和 View 中添加什么。我是 CodeIgniter 的新手。提前致谢。

型号

public function count_rows($status)
{
$this->db->select('status, COUNT(status) as total');
$this->db->group_by('status', $status);
$this->db->get('shopowner');
}

预期的输出是这样的

注册总数:4待批准:2批准 : 1拒绝:1

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