简单分页(without function)

$page_size=3;
$url=@$_SERVER["REQUEST_URI"];
$url=parse_url($url);
$url=@$url['path'];
$numq=mysql_query("select * from news");
$num=@mysql_num_rows($numq);
if(@$_GET['page'])
$page_val=@$_GET['page'];
else
$page_val=1;
$page=($page_val-1)*$page_size;
if($num>$page_size){
	if($page_val<=1)$page_val=1;
	echo"共$num 条".
	"<a href=$url?page=".($page_val-1).">上一页</a> <a href=$url?page=".($page_val+1).">下一页</a><br/><hr color='yellow'/>";
}	


你可能感兴趣的:(简单分页(without function))