源代码如下:
<?php
session_start();
?>
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ />
<style type=”text/css”>
body{background:#000;}
body,div,ul,li,img{padding:0;margin:0; border:0; list-style:none;}
.all{width:~来1源gaodai#ma#com搞*代#码1网搞代gaodaima码630px; border:1px solid #ccc; margin:100px auto; overflow:hidden; padding:10px 0 0 10px;}
li{width:200px; height:186px; float:left; margin-right:10px; margin-bottom:10px; cursor:pointer;}
#apDiv1 {
position: absolute;
width: 444px;
height: 60px;
z-index: 1;
left: 350px;
top: 15px;
}
#apDiv2 {
position: absolute;
width: 200px;
height: 115px;
z-index: 2;
left: 393px;
top: -2px;
}
</style>
<link href=”css/css.css” rel=”stylesheet” type=”text/css” />
<script src=”js/js.js” type=text/javascript></script>
<body>
<?php
$conn=mysql_connect(“localhost”,”root”,””);
mysql_select_db(“dzsw”,$conn);
function showpagelink($pagesize,$result,$currentpage,$pageleft,$pageright,$phpfile,$link) //分页显示函数,参数分别为每页记录数,数据集,当前页,左偏移页面数量,右偏移页面数量,链接页面
{
if(!$numRows=mysql_num_rows($link,$result))//获取记录条数
{
var_dump($numRows);
die(“不存在订单信息!”);
}
$totalpage=ceil($totalnum/$pagesize); //计算总页数
var_dump($totalpage);
if($currentpage<1) $page = 1; //处理页码合法性
if($currentpage>$totalpage) $currentpage = $totalpage;
$pagecode=’
if($currentpage!=1)
{
//如果不是第一页,则 显示第一页和上一页的连接
$pagecode.=”<<“;//第一页
$pagecode.=” <“;//上一页
}
if(($pagelink=$currentpage-$pageleft)<=0) $pagelink=1;
while($pagelink<$currentpage)
{
$pagecode.=” $pagelink “;
$pagelink++;
}
$pagecode.=” $currentpage “; //输出当前页
$pagelink=$currentpage+1;
$i=0;
while($pagelink<=$totalpage and $i<$pageright)
{
$pagecode.=” $pagelink “;
$pagelink++;
$i++;
}
if($currentpage!=$totalpage){
//如果是最后一页,则不显示最后一页和下一页的连接
$pagecode.=” >”;//下一页
$pagecode.=” >>”;//最后一页
}
$pagecode.=” $currentpage/$totalpage 共为您查到”.$totalnum.”个数据“; //第几页,共几页
$pagecode.=”
“;
echo $pagecode;
}
function showpagedetail($pagesize,$query,$currentpage,$link) //页面数据显示函数
{
$limit=intval($pagesize*($currentpage-1));
$query.=” limit $limit,$pagesize”;
$result=mysqli_query($link,$query);
//查找数据,注意参数顺序和mysql_query区别,数据库连接在前,语句在后。
while($info=mysqli_fetch_array($result,MYSQL_BOTH))
{
//$data[]=$info;
echo “
“;
}
}
?>
- 首页
- 资讯
- 潮城
- 潮人
- 留言
订单中心
<?php
$conn=mysql_connect(“localhost”, “root”, “”);
mysql_select_db(“dzsw”,$conn);
$link = mysqli_connect(“localhost”, “root”,””,”dzsw”);
if (!$link) {
echo “Connect failed: “, mysqli_connect_error();
exit();
}
//mysqli_query(“SET CHARACTER SET gb2312”);
$query=”SELECT * FROM 31201304_dazueye_plans WHERE plans_user_id = ‘”.$_SESSION[“user_name”].” ‘” ;
//$result=mysql_query($query,$conn); //查找数据
$result=mysqli_query($link,$query);
//初始化分页设置
$pagesize=2;
$phpfile=”user_cart.php”;
if(!$currentpage=@$_GET[“currentpage”]) $currentpage=1;
$pageleft=2;
$pageright=2;
//初始化结束
showpagedetail($pagesize,$query,$currentpage,$link);
showpagelink($pagesize,$result,$currentpage,$pageleft,$pageright,$phpfile,$link); //调用分页链接函数
mysqli_close($link);
?>
-
商业合作邮箱微博
-
传真:010- 01234567
-
友情链接
-