[英]controller doesn't return any value using codeigniter
我不知道我的代碼有什么問題,它不返回任何數據
控制者
function FundCluster(){
$cluster=$this->input->post('funds');
$this->load->model('Jev_model');
$fund= $this->Jev_model->getFundCluster($cluster);
$fundCluster= $fund['FundCluster'].$cluster;
$this->insert_entry($fundCluster);
}
模型
function getFundCluster($cluster){
$this->db->select('FundCluster');
$this->db->from('fund');
$this->db->where('id', $cluster);
$query = $this->db->get();
return $query->result_array();
}
我想要的就是獲得這條線的價值
$fundCluster= $fund['FundCluster'].$cluster;
這樣做的目的是將該變量傳遞給其他函數
function insert_entry($fundcluster) {
$series=$fundcluster;
...
..
.
redirect('Jev/entryAccount/'.$series);
}
您可能必須使用。
$fund[0]['FundCluster']
改變模型
return $query->result_array();
至
return $query->row();
在控制器中
$fundCluster= $fund['FundCluster'].$cluster;
至
$fundCluster= $fund->FundCluster;
嘗試使用
$query->row();
而不是
$query->result_array();
它將給您對象,您可以像
$fundCluster= $fund->FundCluster.$cluster;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.