我遇到了一个奇怪的问题。我有一个简单的网络与一些验证规则,我已经在我的pc上运行了几个星期,它更新了一个数据库。在本地主机上运行的测试阶段,一切都运行得很好
此后,我将web表单和数据库移动到了我的服务器上,当输入本地计算机应该接受的数据时,我得到了以下错误
错误:您正在尝试输入无法存储或包含代码的信息。请重新调整from,然后重试不正确的整数值:第1行的列'entryID‘的'NULL’
下面是表单处理的基本代码
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>";
}
?>我哪里错了?
发布于 2012-07-25 22:30:33
尝试删除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."' )";发布于 2012-07-25 22:14:59
我假设entryID是一个自动递增的字段?如果是,只需将其从查询中删除即可。
https://stackoverflow.com/questions/11651478
复制相似问题