<?php header("content-type:text/html;charset=utf-8"); include_once("conn.php"); if(!($_POST['bookname']and $_POST['price'] and $_POST['f_time'] and $_POST['type'])){ echo "输入不允许为空。单击<a href='javascript:onclick=history.go(-1)'>这里</a> 返回"; }else{ $result = mysqli_query($conn,$sqlstr1); if($result){ $sqlstr1 ="insert into tb_demo02 values(","'.$_POST['bookname'].'","'.$_POST['bookname'].' ","'.$_POST['bookname'].'","'.$_POST['bookname'].'")"; echo "添加成功,点击<a href='select.php'>这里</a>查看"; }else{ echo "<script>alert('添加失败');history.go(-1);</script>"; } }?>Parse error: syntax error, unexpected ',' in C:\xampp\htdocs\11.php on line 9
3 回答
已采纳
LIANHK
TA贡献78条经验 获得超17个赞
看错误提示是第9行,我尝试看了下,应该改为
$sqlstr1 ='insert into tb_demo02 values("'.$_POST['bookname'].'","'.$_POST['bookname'].' ","'.$_POST['bookname'].'","'.$_POST['bookname'].'")";
第一个字符串前面是双引号,你后面又用了单引号,sql语句还多可个逗号
望采纳
- 3 回答
- 0 关注
- 1034 浏览
添加回答
举报
0/150
提交
取消