错误信息:第54行中包含一个语法错误,在此错误解决之前,代码提示可能无法正常工作 运行后显示: Parse error: syntax error, unexpected T_EXIT, expecting ',' or ';' in D:\phpdev\wwwroot\index1.php on line 54
这个错误是告诉你缺少一个分号。echo"<script> alert('名城不能有特殊字符!');location.href='index1.php';</script>;" and exit();分号没了 其他的数据库信息和你的逻辑还不够清楚。
运算符号可以用来处理数字、字符串及其它需要比较运算的条件。PHP 的运算符号和 C 语言的运算符号与很类似,对于有经验的程序设计人员,应可以很顺利的掌握 PHP 的运算符号。
不同的运算符号,其实还是有优先顺序,就像小时候在学数学时,老师会教:先乘除、后加减。在 PHP 的运算优先顺序可以参考下面的表格,在混合式的情形下,愈往下表示优先权愈高。至于符号代表的意义,散见于以下的章节中。运算符号 结合规则
, 左至右
or 左至右
xor 左至右
and 左至右
.= &= |= /= %= ^= = += -= *= 左至右
? : 左至右
|| 左至右
&& 左至右
| 左至右
^ 左至右
& 左至右
== != 不限
< <= >= > 不限
<< >> 左至右
+ - . 左至右
* / % 左至右
! ~ ++ -- @ 右至左
[] 右至左
我看很多网站上都是这样的 用一个页面实现所有要求
运行后显示:
Parse error: syntax error, unexpected T_EXIT, expecting ',' or ';' in D:\phpdev\wwwroot\index1.php on line 54
and exit();分号没了
其他的数据库信息和你的逻辑还不够清楚。
echo"<script> alert('留言不能为空!');location.href='index1.php';</script>;"
我看你上面很多如红色部分没有结尾符“;”,加上去就没这个错误了
下面输出<script>脚本的时候还有。请注意改正。
mysql_query("insert into guest(username,tel,content) values ('$username','$tel','$content');");
username,tel,content数据库这三项的数据类型是哪种?如果是字符型需要
mysql_query("insert into guest(username,tel,content) values ('".$username."',''".$tel."','".$content."');");
应该是: mysql_query("insert into guest(username,tel,content) values ('".$username."','".$tel."','".$content."');");