作者:159dzhqian449_734 | 来源:互联网 | 2017-05-14 02:21
文章id传不进去!!!$id];,已经测试有这个值。。PHPcode<divid"addComment"style"width:800px;height:350px;margin-left:0px;"><formaction"addcommentPr
文章id传不进去!!!
$id=$row['id'];,已经测试有这个值。。
PHP codehttp://www.CodeHighlighter.com/-->
addcommentProcess.php代码如下
$id=$_GET['id'];
$article_comment=$_POST['article_comment'];
$cOnn=mysql_connect("localhost","root","5200");
if(!$conn){
die ("连接失败".mysql_error());
}
mysql_select_db("blog",$conn) or die(mysql_error());
mysql_query("set names utf8");
$sql="insert into comment (id,article_comment) value ('$id','$article_comment')";
//我自己在mysql里面输入insert into comment (id,article_comment) value ('8','aaa');可以插入内容。
mysql_query("set names utf8");
$res=mysql_query($sql) or die(mysql_error());
if($res){
header("location:index.php");
}
?>
点击 发表评论的时候 显示错误:
Incorrect integer value: '$id' for column 'id' at row 1
------解决方案--------------------当然是传不过去啦
你
$id=$_GET['id'];
得到的是 '$id'
因为你在表单页并没有传递 $id 的值
------解决方案--------------------八成是$id没有值