我嘗試更新我上傳的文件,但直至現在PHP MySQL的笨更新上傳文件陣
我得到eror消息「erorr號1064」。
這裏我的模型
public function update_tool_document($context, $data){
$header = "";
for($i=1;$i<=10;$i++){
$header .= ", doc_title_" . $i. " = '" . $data['doc']['title'][$i-1] . "'";
$header .= ", doc_display_" . $i. " = '" . $data['doc']['show'][$i-1] . "'";
$header .=", link_to_doc_file_" . $i. " = '".(($data['doc']['link'][$i-1] != "")?"'".$data['doc']['link'][$i-1]."'":"link_to_doc_file_".$i)."'";
}
$query = "UPDATE ms_tool_type_document SET $header
WHERE tool_code = '".$data['tool_code']."'";
$table = $context->db->query($query);
return $table;
}
什麼毛病link_to_doc_file。錯誤結果是這樣的: 錯誤號:1064
您的SQL語法錯誤;檢查對應於你的MySQL服務器版本使用附近的「doc_title_1 =‘Tesst正確的語法手冊’,doc_display_1 =‘’,link_to_doc_file_1 =‘’材料/政黨成員」在1號線
UPDATE ms_tool_type_document SET , doc_title_1 = 'Tesst', doc_display_1 = '', link_to_doc_file_1 = ''material/tutorial-prestashop.pdf'', doc_title_2 = 'hahaha', doc_display_2 = '', link_to_doc_file_2 = ''material/201512101342_INVOICE-NKOPP.pdf'', doc_title_3 = '', doc_display_3 = '', link_to_doc_file_3 = 'link_to_doc_file_3', doc_title_4 = '', doc_display_4 = '', link_to_doc_file_4 = 'link_to_doc_file_4', doc_title_5 = '', doc_display_5 = '', link_to_doc_file_5 = 'link_to_doc_file_5', doc_title_6 = '', doc_display_6 = '', link_to_doc_file_6 = 'link_to_doc_file_6', doc_title_7 = '', doc_display_7 = '', link_to_doc_file_7 = 'link_to_doc_file_7', doc_title_8 = '', doc_display_8 = '', link_to_doc_file_8 = 'link_to_doc_file_8', doc_title_9 = '', doc_display_9 = '', link_to_doc_file_9 = 'link_to_doc_file_9', doc_title_10 = '', doc_display_10 = '', link_to_doc_file_10 = 'link_to_doc_file_10' WHERE tool_code = 'T00005'
文件名:C:\ XAMPP \ htdocs中\ lalalala \ SYSTEM \數據庫\ DB_driver.php
Line Number: 331
缺失列名'設置$頭...' – Saty
我嘗試更新上傳文件的列是link_to_doc_file – billie