每当我在模型中使用get_where它给了我所有数据库条目,包括复制,当我用得到的只有它只是给我的第一个条目。 但我想所有不同的条目。 谁能帮我请。 非常感谢!
CONTROLER = site.php:
public function western_australia(){
$this->load->model("continents_get");
$data["results"] = $this->continents_get
->getMaincategories("western_australia");
$this->load->view("content_western_australia", $data);
}
模型= continents_get.php
function getMaincategories($western_australia){
$this->db->distinct();
$query = $this->db->get_where("p_maincategories",
array("page" => $western_australia));
return $query->result();
}
视图= content_western_australia.php
<?php
foreach($results as $row){
$page = $row->page;
$main_en = $row->main_en;
echo $main_en;
?>