這是我的代碼:Codeigniter - SQL錯誤。讓我瘋狂
$ child = $ this-> getDetails($ row ['ParentOf_Id']);
這是在調用一個函數調用getdetails另一個功能:
功能getDetails($ child_id = NULL,$限制= 20){
// select all the fields in the children table
$this->db->select(castedColumns($this->children_table, $this->db));
//where the id is the child id
$q = $this->db->get_where($this->children_table, 'id='.$child_id);
//store results array in details
$details = $q->row_array();
然後我得到下面的SQL錯誤:
數據庫出錯 錯誤號:
附近有語法錯誤 '='。
SELECT CAST(文字AdditionalNotes)作爲AdditionalNotes,CAST(DisabilitiesNotes文本)作爲DisabilitiesNotes,出生日期,msrepl_tran_version兒童WHERE ID =
id沒有追加?爲什麼?
一直在推動我堅果,因爲,當我做echo $ child_id;在將它傳遞到SQL之前,我得到了子Id。
得到它的工作,$ child_id = null更改爲$ child_id和mikhail解決方案似乎已經做到了。乾杯。 – bobo2000 2012-03-16 17:54:15