You have an error in your SQL syntax; check the manual that corresponds to your MySQL server versio$sql="insert into 'test1'('name','date','text') values('$name','$date','$liuyanneirong')";if(mysql_query($sql)){if(mysql_affected_rows() >= 1 )echo 'in
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/22 03:40:46
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server versio$sql="insert into 'test1'('name','date','text') values('$name','$date','$liuyanneirong')";if(mysql_query($sql)){if(mysql_affected_rows() >= 1 )echo 'in
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server versio
$sql="insert into 'test1'('name','date','text') values('$name','$date','$liuyanneirong')";
if(mysql_query($sql))
{
if(mysql_affected_rows() >= 1 )
echo 'insert ok!';
else
echo mysql_error();
}
else
{
echo mysql_error();
}
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server versio$sql="insert into 'test1'('name','date','text') values('$name','$date','$liuyanneirong')";if(mysql_query($sql)){if(mysql_affected_rows() >= 1 )echo 'in
1,对于mysql中的 表名 和字段名是不可以使用 单引号的,要使用`
2,test1是否存在,及字段及类型是否正确,插入的值和字段的个数或类型一一对应
3,好像你没有conn连接啊
修改如下
//没有看到你的数据库conn链接啊
@$conn = mysql_connect("yourHost","yourUserID","yourPassword");
$sql="insert into `test1` (`name`,`date`,`text`) values ('$name','$date','$liuyanneirong')";
//mysql_query 执行时使用conn
if(mysql_query($sql,@$conn))
{
if(mysql_affected_rows() >= 1 )
echo 'insert ok!';
else
echo mysql_error();
}
else
{
echo mysql_error();
}