请教各位一个PHP问题

JH5221314 2012-04-27 10:45:47
当我运行一下代码的时候出现了:Parse error: syntax error, unexpected $end in D:\wwwlocal\library\book.php on line 89的错误,(检查不出来错了)我的代码是:
<?php session_start();?>
<html>
<head>
<title>图书馆管理系统</title>
<link href="CSS/style.css" rel="stylesheet">
</head>
<body>
<table width="778" border="0" align="center" cellpadding="0" cellspacing="0" class="tableBorder">
<tr>
<td>
<?php include("navigation.php");?>
</td>
</tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top" bgcolor="#FFFFFF"><table width="99%" height="510" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" class="tableBorder_gray">
<tr>
<td height="510" valign="top" style="padding:5px;"><table width="98%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="22" valign="top" class="word_orange">当前位置:图书管理 > 图书档案管理 >>></td>
</tr>
<tr>
<td align="center" valign="top">
<?php
include("Conn/conn.php");
$query=mysql_query("select book.barcode,book.id as bookid,book.bookname,bt.typename,pb.pubname,bc.name from tb_bookinfo book join tb_booktype bt on book.typeid=bt.id join tb_publishing pb on book.ISBN=pb.ISBN join tb_bookcase bc on book.bookcase=bc.id");
$result=mysql_fetch_array($query);
if($result==false){
?>
<table width="100%" height="30" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="36" align="center">暂无图书信息!</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<a href="book_add.php">添加图书信息</a> </td>
</tr>
</table>
<?php
}else{
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="87%">  </td>
<td width="13%">
<a href="book_add.php">添加图书信息</a></td>
</tr>
</table>
<table width="98%" border="1" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF" bordercolordark="#D2E3E6" bordercolorlight="#FFFFFF">
<tr align="center" bgcolor="#e3F4F7">
<td width="13%">条形码</td>
<td width="26%">图书名称</td>
<td width="15%">图书类型</td>
<td width="14%">出版社</td>
<td width="12%">书架</td>
<td width="6%">修改</td>
<td width="5%">删除</td>
</tr>
<?php do{ ?>
<tr>
<td style="padding:5px;"> <?php echo $result[barcode];?></td>
<td style="padding:5px;"><a href="book_look.php?id=<?php echo $result[bookid];?>"><?php echo $result[bookname];?></a></td>
<td style="padding:5px;"> <?php echo $result[typename];?></td>
<td style="padding:5px;"> <?php echo $result[pubname];?></td>
<td style="padding:5px;"> <?php echo $result[name];?></td>
<td align="center"><a href="book_Modify.php?id=<?php echo $result[bookid];?>">修改</a></td>
<td align="center"><a href="book_del.php?id=<?php echo $result[bookid];?>">删除</a></td>
</tr>
<?
}while($result=mysql_fetch_array($query));
}
?>
</table></td>
</tr>
</table>
</td>
</tr>
</table><?php include("copyright.php");?></td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
...全文
3581 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
JH5221314 2012-04-27
  • 打赏
  • 举报
回复
PHP Parse Error: syntax error, unexpected $end 错误解决
作者:吕海鹏 文章来源:itstudy原创 发表时间:2008-10-24 11:58:24
阅读次数:今日:8 本周:71 本月:305 总计:5714
--------------------------------------------------------------------------------
这几天写php程序,感觉很多地方不如asp,asp.Net,jsp顺手,比如session使用先得session_start();,文件跳转header用的也不方便....
也许是不熟悉的php的一些特性吧,不过写多了,也就慢慢适应将就了.....

这里就整理一个代码编写调试问题,错误如下:

Parse error: syntax error, unexpected $end in D:\xampp\htdocs\guestBook\guestBook.php on line 330


看看程序 330行,代码最后一行,这有什么错误?google搜,找到了:

In PHP 5, the following error may appears as an error entry in Apache error log or simply displays on PHP web page, even if calling to php scripts with php_info() works perfectly and successfully returns information on PHP configurations:

Parse Error: syntax error, unexpected $end in ….. scripts.php on line …

The error may caused by a missing curly bracket in PHP script coding. Beside, it may also caused by error in PHP coding in class definition, as in PHP, a class definition cannot be broke up and distributed into multiple files, or into multiple PHP blocks, unless the break is within a method declaration.

But more commonly, the error is often caused by the use of Short Open tags in PHP,

To use short open tags, it must be enabled in PHP.INI. Search for short_open_tag in PHP.INI, and change the value to On. The line should look line:

short_open_tag = On


欺我英文不好啊?看看其它几条搜索,都没说到点子上,那就看看英文了,虽不能如数翻译,大致意思是瞧明白了:

错误发生是使用了短标签,可以在php.ini中设置short_open_tag = On



原来Parse error 提示一般是 语法错误,使用了开放的标签,语句没有结束 也就是编程基本的一些错, 比如没注意 语句结束加 ";" 或者 if(){...} 后面忘了"}" ;〈?php...?〉忘了“?〉”。仔细检查代码,果然是一处漏掉了“}”,修改程序正常运行


乌镇程序员 2012-04-27
  • 打赏
  • 举报
回复
<? //这里使用了短标签,改为<?php试试
}while($result=mysql_fetch_array($query));
}
?>

21,886

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧