<a href="add.php">发表留言</a>
<?php
require('common.php');
$countRow = mysql_fetch_array(mysql_query("SELECT count(*) FROM gb_content"), MYSQL_BOTH);
$count = $countRow[0]; //总行数
if (isset($_GET['page']))(
$_GET['page'] = intval($_GET['page']); )
if ($_GET['page']<=0) {
$_GET['page'] = 1;
}
$lines = 10; // 每页行数
$page = $_GET['page'];// 当前页
$limit = ($page - 1) * $lines;//起启行
$total = ceil($count/$lines); // 总页数
$result = mysql_query("SELECT * FROM gb_content order by id desc limit " .$limit. ','.$lines.'');//查询数据
while ($row = mysql_fetch_array($result, MYSQL_BOTH)) {// 取一条数据
?>
<table width="700" border="0" cellspacing="0" cellpadding="0" class="tb">
<tr>
<td class="bg"><b>[<?php echo htmlentities($row['username']) ?>]</b> 发表于:<?php echo htmlentities($row['insert_time']) ?></td>
</tr>
<tr>
<td><?php echo htmlentities($row['content']) ?></td>
</tr>
<tr>
<td align="right"><a href="edit.php?id=<?php echo $row['id'] ?>">修改</a> <a href="delete.php?id=<?php echo $row['id'] ?>">删除</a></td>
</tr>
</table>
<?php
}
mysql_free_result($result);
if ($page>1) {
echo '<a href="?page=1">首页</a> <a href="?page='. ($page-1) .'">上一页</a>';
}
if ($page<$total) {
echo ' <a href="?page=' . ($page+1) .'">下一页</a> <a href="?page='.$total.'">末页</a>';
}
?> 这里
if (isset($_GET['page']))(
$_GET['page'] = intval($_GET['page']); )
提示出错
Parse error: syntax error, unexpected ';' in F:\apmxe\htdocs\notebook\index.php on line 16
不加if 叛断,用$_GET['page'] = intval($_GET['page']); 这个由于变量没初始出错,那个IF加上去会有什么错的吗
<?php
require('common.php');
$countRow = mysql_fetch_array(mysql_query("SELECT count(*) FROM gb_content"), MYSQL_BOTH);
$count = $countRow[0]; //总行数
if (isset($_GET['page']))(
$_GET['page'] = intval($_GET['page']); )
if ($_GET['page']<=0) {
$_GET['page'] = 1;
}
$lines = 10; // 每页行数
$page = $_GET['page'];// 当前页
$limit = ($page - 1) * $lines;//起启行
$total = ceil($count/$lines); // 总页数
$result = mysql_query("SELECT * FROM gb_content order by id desc limit " .$limit. ','.$lines.'');//查询数据
while ($row = mysql_fetch_array($result, MYSQL_BOTH)) {// 取一条数据
?>
<table width="700" border="0" cellspacing="0" cellpadding="0" class="tb">
<tr>
<td class="bg"><b>[<?php echo htmlentities($row['username']) ?>]</b> 发表于:<?php echo htmlentities($row['insert_time']) ?></td>
</tr>
<tr>
<td><?php echo htmlentities($row['content']) ?></td>
</tr>
<tr>
<td align="right"><a href="edit.php?id=<?php echo $row['id'] ?>">修改</a> <a href="delete.php?id=<?php echo $row['id'] ?>">删除</a></td>
</tr>
</table>
<?php
}
mysql_free_result($result);
if ($page>1) {
echo '<a href="?page=1">首页</a> <a href="?page='. ($page-1) .'">上一页</a>';
}
if ($page<$total) {
echo ' <a href="?page=' . ($page+1) .'">下一页</a> <a href="?page='.$total.'">末页</a>';
}
?> 这里
if (isset($_GET['page']))(
$_GET['page'] = intval($_GET['page']); )
提示出错
Parse error: syntax error, unexpected ';' in F:\apmxe\htdocs\notebook\index.php on line 16
不加if 叛断,用$_GET['page'] = intval($_GET['page']); 这个由于变量没初始出错,那个IF加上去会有什么错的吗
解决方案 »
- 关于session的范围的问题
- 右击查看源码出现乱码
- 各位老师我只安装了AppServ套件和zend studio后什么也没有做,测试localhost好使,但。。。
- Warning: ldap_add(): Add: Operations error in
- 帮个忙,哈哈!
- 乱码问题
- (深圳)网络公司若干PHP网站程序找PHP程序员外包,可长期合作
- PHP下在MySQL3.23.54里支持UNION ALL语句吗?
- 为各位带来特大喜讯,我开服务器支持PHP+MYSQL,免费提供,需要者联系
- 搜索A表在B表里没有数据的记录怎么写SQL语句?
- php 循环输出问题 贴代码
- 高分悬赏::PHP建立的777权限目录,为什么下面不能再建立目录和文件呢?
$_GET['page'] = intval($_GET['page']); )
语法错误
改:
if (isset($_GET['page'])){
$_GET['page'] = intval($_GET['page']);
}
一个中括号,一个小括号