2012-07-25 166 views
1

我遇到一個奇怪的問題。我有一個簡單的網絡,有一些驗證規則,我一直在我的電腦上運行幾個星期來更新數據庫。它已全部在測試階段,在本地主機上運行從測試服務器移動到活服務器時PHP和mysql錯誤

因爲我已經搬到Web表單和數據庫到我的服務器運行良好,並輸入數據,應該在何時接受我的本地機器上,我得到以下錯誤

錯誤:您正試圖輸入無法存儲或包含代碼的信息。請refesh的距離,然後再試一次 不正確的整數值:「NULL」爲「ENTRYID」列在第1行

這裏是表單處理

mysql_connect ("host", "username" , "password") or die ('Error: ' .mysql_error()); 
mysql_select_db ("name of database"); 

$query= "INSERT INTO entry (entryID, studentName , tutorName , procedureName , grade , studentReflection , tutorComments, professionalism , communication , alert , dispute) VALUES ('NULL', '".$options1."' , '".$options2." ' , '".$procedure."' , '".$grade."' , '".$studentReflection."', '".$tutorComments."' , '".$professionalism."' , '".$communication."' , '".$alert."' , '".$dispute."')"; 


mysql_query($query) or die ('Error : You are attempting to enter information which cannot be stored or contains code. Please refesh the from and try again<br>' .mysql_error()); 


echo "<h3>The database has been updated.</br> Thank You </br><a href='form.php'>Enter another procedure</h3>"; 
} 
?> 

我要去哪裏錯了基本的代碼?

+0

如果您發佈的代碼和查詢的人將有機會來解決它:) – Fluffeh 2012-07-25 14:01:42

+0

我已經添加了代碼 – user1132612 2012-07-25 14:05:10

回答

2

嘗試刪除單引號NULL左右。

我認爲你有entryID

$query= "INSERT INTO entry (entryID, studentName , tutorName , procedureName , grade , studentReflection , tutorComments, professionalism , communication , alert , dispute) VALUES (NULL, '".$options1."' , '".$options2." ' , '".$procedure."' , '".$grade."' , '".$studentReflection."', '".$tutorComments."' , '".$professionalism."' , '".$communication."' , '".$alert."' , '".$dispute."')"; 

自動增量選項設置或嘗試'',而不是NULL本身

$query= "INSERT INTO entry (entryID, studentName , tutorName , procedureName , grade , studentReflection , tutorComments, professionalism , communication , alert , dispute) VALUES ('', '".$options1."' , '".$options2." ' , '".$procedure."' , '".$grade."' , '".$studentReflection."', '".$tutorComments."' , '".$professionalism."' , '".$communication."' , '".$alert."' , '".$dispute."')"; 
+0

非常感謝,這已經工作 – user1132612 2012-07-25 14:50:27

+0

歡迎.... :) – Makesh 2012-07-25 14:51:32

2

我想entryID是一個自動遞增字段?如果是這樣,只需從查詢中刪除它。