後,我使用CodeIgniter的PHP框架着手,PHP函數甚至返回
在我的模型,我有這樣的功能(簡體):
public function do_stuff($id=FALSE)
{
// Get all rows from `Table A`
$result_table_a = $this->db->get('table_a')->result_array();
// Update `Table B` data
$update_table_b = $this->db->update('table_b', $data);
// If failed to update `Table B` return FALSE
if (!$update_table_b || $this->db->affected_rows()<1)
{
$this->data['message'] = '<p>Failed to Update (#34)!</p>';
return FALSE;
}
// Update all selected rows from `Table A`
foreach ($result_table_a AS $result)
{
$this->function_to_update_table_a($some_data);
}
}
今天我跑這個功能作爲用戶,我看到錯誤Failed to Update (#34)!
,但後來我注意到foreach
循環也運行,其內部的功能已更新table_a以及
這可能嗎?返回後可以繼續工作嗎?
我真的很困惑
這意味着你永遠不會到達你的退貨聲明。你需要弄清楚爲什麼。 –
嘗試調試你的代碼.. –
@JohnConde但是,那麼錯誤是如何顯示的? – Vladimir