<?
require_once('config.php');
if($s_class==''){
$exec="select * from products where b_class='1'";
}else{
$exec="select * from products where b_class='1' and s_class='$s_class'";
}
$result=mysql_query($exec); $recountCount = mysql_num_rows($result);
$totalPage = ceil($recountCount/10);
$page = (isset($page) && $page>=0)? $page: 0;
$isLast = ($page==($totalPage-1))? true: false;
$hasNoPre = ($page==0)? true: false;
$hasNoNext = ($page==$totalPage-1)? true: false;
$isFirst = ($page==0)? true:false;
if($s_class==''){
$exec="select * from products where b_class='1' order by id desc limit ".($page*10).",10";//一页是10记录的
} else {
$exec="select * from products where b_class='1' and s_class='$s_class' order by id desc limit ".($page*10).",10";//一页是10记录的
}
$result=mysql_query($exec);
$count=mysql_num_rows($result);
$col=2;
$row=floor($count/$col);
$eol=$count%$col;
if($eol>0)
$row++;
echo " <table border=0 width=100%>";
for($i=0; $i<$row; $i++)
{
echo "<tr>";
for($j=0; $j<$col; $j++)
{
$rs=mysql_fetch_object($result);
if($rs==false)
echo "";
else {
?>
<td>
<img border=0 src=<? echo "$rs->s_img";?> width=100 height=100>
<table border="0"><tr><td height="1"></td></tr></table>
<a href=products/list.php?id=<? echo "$rs->id"; ?>><img border=0 src=images/dg.gif width=101 height=22></a>
</td>
<td valign=top>
<table border=0 width=100% cellspacing=1>
<tr>
<td width=50% nowrap valign=top>品号:</td>
<td width=50% valign=top><img src="images/copyright.gif"><? echo "$rs->number"; ?></td>
</tr>
<tr>
<td width=50% nowrap valign=top>品名:</td>
<td width=50% valign=top><? echo "$rs->name"; ?></td>
</tr>
<tr>
<td width=50% nowrap valign=top>价格:</td>
<td width=50% valign=top><? echo "$rs->price"; ?>元</td>
</tr>
</table>
</td>
<?
} }
echo "</tr>";
}
echo "</table>";
?>
这样写就OK了.留给需要的朋友..
require_once('config.php');
if($s_class==''){
$exec="select * from products where b_class='1'";
}else{
$exec="select * from products where b_class='1' and s_class='$s_class'";
}
$result=mysql_query($exec); $recountCount = mysql_num_rows($result);
$totalPage = ceil($recountCount/10);
$page = (isset($page) && $page>=0)? $page: 0;
$isLast = ($page==($totalPage-1))? true: false;
$hasNoPre = ($page==0)? true: false;
$hasNoNext = ($page==$totalPage-1)? true: false;
$isFirst = ($page==0)? true:false;
if($s_class==''){
$exec="select * from products where b_class='1' order by id desc limit ".($page*10).",10";//一页是10记录的
} else {
$exec="select * from products where b_class='1' and s_class='$s_class' order by id desc limit ".($page*10).",10";//一页是10记录的
}
$result=mysql_query($exec);
$count=mysql_num_rows($result);
$col=2;
$row=floor($count/$col);
$eol=$count%$col;
if($eol>0)
$row++;
echo " <table border=0 width=100%>";
for($i=0; $i<$row; $i++)
{
echo "<tr>";
for($j=0; $j<$col; $j++)
{
$rs=mysql_fetch_object($result);
if($rs==false)
echo "";
else {
?>
<td>
<img border=0 src=<? echo "$rs->s_img";?> width=100 height=100>
<table border="0"><tr><td height="1"></td></tr></table>
<a href=products/list.php?id=<? echo "$rs->id"; ?>><img border=0 src=images/dg.gif width=101 height=22></a>
</td>
<td valign=top>
<table border=0 width=100% cellspacing=1>
<tr>
<td width=50% nowrap valign=top>品号:</td>
<td width=50% valign=top><img src="images/copyright.gif"><? echo "$rs->number"; ?></td>
</tr>
<tr>
<td width=50% nowrap valign=top>品名:</td>
<td width=50% valign=top><? echo "$rs->name"; ?></td>
</tr>
<tr>
<td width=50% nowrap valign=top>价格:</td>
<td width=50% valign=top><? echo "$rs->price"; ?>元</td>
</tr>
</table>
</td>
<?
} }
echo "</tr>";
}
echo "</table>";
?>
这样写就OK了.留给需要的朋友..
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货