php - 无法使用 codeigniter 选择不同的值

标签 php mysql codeigniter

只想使用 codeigniter 从数据库中选择不同的值,但它返回重复值。您能否检查一下我的以下代码有什么问题:

$this->db->distinct('country');
$this->db->where('id',$id);
$query = $this->db->get('table_name');    

最佳答案

可以这样试试吗?

$this->db->distinct();
$this->db->select('country');

关于php - 无法使用 codeigniter 选择不同的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25645191/

相关文章:

c# - 使用 Linq 对三个表进行内联接

php - Facebook Scraped URL 404 欢迎使用 Nginx 错误 [Ningx + PHP-FPM]

php - 如何在单个查询中运行多个查询?

php - 依次播放两个音频文件

MySQL : WHERE IN and OR are not returning the same rows

php - Codeigniter Cookie 帮助

php - 使用连接从多个表中选择列

mysql - MySQL 中的触发器不起作用

php - 当我在两个表中输入一条记录时,总金额可以,如果我在第二个表中插入第二条记录,总金额将增加一倍

mysql - Codeigniter 当用户向请求表提交请求时,如何更新项目表中的数量字段