我从mysql数据库填充下拉列表,它不应该包含重复的值。
我尝试使用distinct关键字但未能使用。我应该使用什么逻辑?
例:我有两个bsc和……
您可以在cat_id上使用group by来获取唯一值。根据你的附件,cat_id也会重复,并且对于相应的course_id也是如此。
function get_data_wheree($table,$where) { $this->db->group_by("cat_id"); return $this->db->get($table,$where)->result(); }