lionel1022
新手上路

UID 99871
精华
0
积分 13
帖子 5
金钱 13 喜悦币
威望 0
人脉 0
阅读权限 10
注册 2007-10-24
状态 离线
|
[广告]: 代充Paypal帐号美元
请大家帮忙看看?分页程序错在那里???
<html>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<body>
<?php
require ('dbconnect.php'); //连接数据库
?>
<?
//得到首页参数
$sort =$_POST['sort'];
$texture =$_POST['texture'];
//查询数据库
$dh=mysql_query(" select count(*) as plm from clothes_id as a, clothes_style as b,clothes_texture as c where a.style_id=b.style_uid and a.texture_id=c.texture_uid and b.style_uid like '$sort%' and c.texture_uid='$texture'",$conn);
$row=mysql_fetch_array($dh);
$row=$data['plm'];
if(empty($offset))
{
$offset=0;
}
$result =mysql_query(" select * from clothes_id as a, clothes_style as b,clothes_texture as c where a.style_id=b.style_uid and a.texture_id=c.texture_uid and b.style_uid like '$sort%' and c.texture_uid='$texture' LIMIT $offset , 2",$conn);
while($row=mysql_fetch_array($result))
{
echo "<img src=$row[9]>";
echo "<br>";
printf("服装名称:" .$row[1]);
echo "<br>";
printf("服装品牌:" .$row[18]);
echo "<br>";
printf("服装分类:" .$row[14]);
echo "<br>";
printf("服装风格:" .$row[24]);
echo "<br>";
printf("服装质地:" .$row[32]);
echo "<br>";
printf("服装颜色:" .$row[28]);
echo "<br>";
printf("服装弹力:" .$row[33]);
echo "<br>";
printf("服装设计师:" .$row[7]);
echo "<br>";
printf("服装价格:" .$row[8]);
echo "<br>";
printf("服装说明:" .$row[11]);
echo "<br>";
echo "<br>";
echo "<br>";
}
if(!$offset)
{
$preoffset=$offset-2;
print "<a href=\"$PHP_SELF?offset=$preoffset\">前一页</a> \n";
printf("preoffes:%s",$preoffget);
}
$pages=ceil($nr/2);
for($i=1;$i<=$pages;$i++)
{
$newoffset=2*$i;
printf("newoffset:%s",$newoffset);
print "<a href=\"$PHP_SELF?offset=$newoffset\">$i</a> \n";
}
if($pages!=0 && ($newoffset/2)!=$pages)
{
print "<a href=\"$PHP_SELF?offset=$newoffset\">下一页</a> \n";
}
?>
</body>
</html>Sample Text
[ 本帖最后由 lionel1022 于 2007-11-15 05:16 PM 编辑 ]
|
|