2012-07-25 144 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是一个自动递增字段?如果是这样,只需从查询中删除它。