Parse error: syntax error, unexpected ')' in D:\coreamp\htdocs\test\lib\page.func.php on line 17
<?php
require_once '../include.php';
$sql="select * from imooc_admin";
$totalRows=getResultNum($sql);
$pageSize=2;
//得到总页码数
$totalPage=ceil($totalRows/$pageSize);
$page=$_REQUEST['page']?(int)$_REQUEST['page']:1;
if($page<1||$page==null||!is_numeric($page)){
$page=1;
}
if($page>=$totalPage)$page=$totalPage;
$offset=($page-1)*$pageSize;
$sql="select * from imooc_admin limit{$offset},{$pageSize}";
$rows=fetchAll($sql);
//print_r($rows);
foreach()$rows as $row){
echo "编号:".$row['id'],"<br/>";
echo "管理员的名称:".$row['username'],"<hr/>";
}
$url=$_SERVER['PHP_SELF'];
for($i=1;$i<=$totalPage;$i++){
if($page==$i){
$p.="[{$i}]";
}else{
$p.="<a href='{$url}?page={$i}'>[{$i}]</a>";
}
}
echo $p;
运行 page.func.php 就会出现 : Parse error: syntax error, unexpected ')' in D:\coreamp\htdocs\test\lib\page.func.php on line 17