正如标题所说。
表单或我的查询是在欺骗我:(
它在我的数据库中输入一个1,而不是我在表单中写的内容。
这是我的表格
<form action="deleteupdate.php" method="post">
<div id="txtHint"></div>
<input type ="submit" name="submittype" value ="Delete">
<input type ="submit" name="submittype" value ="Update">
category: <input type="text" name="category" />
</form>和deleteupdate.php中的查询
else if($_POST['submittype']=="Update"){
mysql_query("INSERT INTO `category`(`category`)
VALUES (category='$category')") ;
}这不应该起作用吗?
发布于 2012-07-15 06:44:22
您的脚本中不存在$category。
使用以下代码:
else if($_POST['submittype']=="Update"){
mysql_query("INSERT INTO `category`(`category`)
VALUES ('". mysql_real_escape_string($_POST['category']) ."')") ;
}发布于 2012-07-15 06:40:31
它应该是
mysql_query("INSERT INTO `category`(`category`)
VALUES ('". mysql_real_escape_string($_POST['category']) ."')") ; https://stackoverflow.com/questions/11487917
复制相似问题