我收到這個函數內置codeigniter沒有SQL錯誤,但我試圖計算作爲參數傳遞的兩個表單輸入之間的區域差異。任何人都可以看到這個功能的問題?Codeigniter成本函數 - 沒有錯誤,但沒有計算
function stationcost($station1,$station2)
{
$data = array();
$this->db->select('station_zone.Zone-sz2.Zone AS Zone' , false)->from('station_zone')->join('station_zone AS sz2','sz2.Station', $station2)->where('station_zone.Station',$station1);
$Q = $this->db->get();
$this->db->select('Cost')->from('zone_cost')->where('Zone_Diff', $Q->row()->Zone_Diff);
$query = $this->db->get();
if ($query->num_rows() > 0)
{
foreach ($query->result() as $row)
{
$data = $row->Cost;
return $data;
}
}
}
非常感謝,
您可以驗證此語句:$ Q-> row() - > Zone_Diff是否返回內容? – 2012-01-12 20:31:18