Hob*_*y99 2 php mysql codeigniter
每当我在模型中使用get_where时,它都会给我所有数据库条目,包括重复,当我使用get时它只给我第一个条目.但我想要所有不同的条目.任何人都可以帮助我.非常感谢!
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);
}
Run Code Online (Sandbox Code Playgroud)
model = continents_get.php
function getMaincategories($western_australia){
$this->db->distinct();
$query = $this->db->get_where("p_maincategories",
array("page" => $western_australia));
return $query->result();
}
Run Code Online (Sandbox Code Playgroud)
view = content_western_australia.php
<?php
foreach($results as $row){
$page = $row->page;
$main_en = $row->main_en;
echo $main_en;
?>
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
6953 次 |
最近记录: |