每日博客4.21

<?php
session_start();
include_once 'conn.php';
//xuxyxaodenxglxxu
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">

<HTML xmlns="http://www.w3.org/1999/xhtml"><HEAD>

<TITLE>商品信息</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<LINK href="qtimages/style.css" type=text/css rel=stylesheet>
<META content="MSHTML 6.00.2900.6058" name=GENERATOR></HEAD>


<script type="text/javascript" src="js/My97DatePicker/WdatePicker.js" charset="gb2312"></script>
<!--hxsglxiangdxongjxs-->
<BODY>
<?php include_once 'qttop.php';?>
<TABLE cellSpacing=0 cellPadding=0 width=1120 align=center bgColor=#ffffff
border=0>
<TBODY>
<TR>
<TD width=5>&nbsp;</TD>
<TD vAlign=top width=230>
<?php include_once 'qtleft.php';?>
</TD>
<TD vAlign=top width=10>&nbsp;</TD>
<TD vAlign=top>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD vAlign=bottom height=40>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD width=44 height=40><IMG height=35
src="qtimages/B0039.gif"
width=30></TD>
<TD width=11>&nbsp;</TD>
<TD width=209><span class="red"><strong>商品信息</strong></span></TD>
<TD vAlign=bottom align=right width=50></TD>
<TD vAlign=bottom align=right width=45>&nbsp;</TD>
<TD align=left width=291>&nbsp;&nbsp;</TD>
</TR></TBODY></TABLE></TD></TR>
<TR>
<TD bgColor=#dadada height=1></TD></TR>
<TR>
<TD bgColor=#f6f6f6 height=4></TD></TR>
<TR>
<TD bgColor=#ffffff height=6>



<form id="form1" name="form1" method="post" action="">
搜索: 商品编号:<input name="shangpinbianhao" type="text" id="shangpinbianhao" style='border:solid 1px #000000; color:#666666;80px' /> 商品名称:<input name="shangpinmingcheng" type="text" id="shangpinmingcheng" style='border:solid 1px #000000; color:#666666;80px' /> 商品类别:<select name='shangpinleibie' id='shangpinleibie' style='border:solid 1px #000000; color:#666666;'><option value="">所有</option><?php getoption("shangpinleibie","leibie")?></select></select>
<input type="submit" name="Submit" value="查找" style='border:solid 1px #000000; color:#666666' />&nbsp;<input type="button" name="Submit3" value="切换视图" style='border:solid 1px #000000; color:#666666' onClick="location.href='shangpinxinxilisttp.php';" />
</form>
<table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" bordercolor="#00FFFF" style="border-collapse:collapse" class="newsline">
<tr>
<td width="25" bgcolor="#CCFFFF">序号</td>
<td bgcolor='#CCFFFF'>商品编号</td><td bgcolor='#CCFFFF'>商品名称</td><td bgcolor='#CCFFFF'>商品类别</td><td bgcolor='#CCFFFF'>品牌</td><td bgcolor='#CCFFFF'>图片</td><td bgcolor='#CCFFFF'>价格</td><td bgcolor='#CCFFFF'>库存数量</td><td bgcolor='#CCFFFF'>用户评价</td>

<td width="30" align="center" bgcolor="#CCFFFF">操作</td>
</tr>
<?php
$sql="select * from shangpinxinxi where 1=1";

if ($_POST["shangpinbianhao"]!=""){$nreqshangpinbianhao=$_POST["shangpinbianhao"];$sql=$sql." and shangpinbianhao like '%$nreqshangpinbianhao%'";}
if ($_POST["shangpinmingcheng"]!=""){$nreqshangpinmingcheng=$_POST["shangpinmingcheng"];$sql=$sql." and shangpinmingcheng like '%$nreqshangpinmingcheng%'";}
if ($_POST["shangpinleibie"]!=""){$nreqshangpinleibie=$_POST["shangpinleibie"];$sql=$sql." and shangpinleibie like '%$nreqshangpinleibie%'";}
$sql=$sql." order by yonghupingjia desc";

$query=mysql_query($sql);
$rowscount=mysql_num_rows($query);
if($rowscount==0)
{}
else
{
$pagelarge=10;//每页行数;
$pagecurrent=$_GET["pagecurrent"];
if($rowscount%$pagelarge==0)
{
$pagecount=$rowscount/$pagelarge;
}
else
{
$pagecount=intval($rowscount/$pagelarge)+1;
}
if($pagecurrent=="" || $pagecurrent<=0)
{
$pagecurrent=1;
}

if($pagecurrent>$pagecount)
{
$pagecurrent=$pagecount;
}
$ddddd=$pagecurrent*$pagelarge;
if($pagecurrent==$pagecount)
{
if($rowscount%$pagelarge==0)
{
$ddddd=$pagecurrent*$pagelarge;
}
else
{
$ddddd=$pagecurrent*$pagelarge-$pagelarge+$rowscount%$pagelarge;
}
}

for($i=$pagecurrent*$pagelarge-$pagelarge;$i<$ddddd;$i++)
{
?>
<tr>
<td width="25"><?php echo $i+1;?></td>
<td><?php echo mysql_result($query,$i,shangpinbianhao);?></td><td><?php echo mysql_result($query,$i,shangpinmingcheng);?></td><td><?php echo mysql_result($query,$i,shangpinleibie);?></td><td><?php echo mysql_result($query,$i,pinpai);?></td><td width='80'><a href="<?php echo mysql_result($query,$i,tupian) ?>" target='_blank'><img src='<?php echo mysql_result($query,$i,tupian) ?>' width='80' height='88' border='0'></a></td><td><?php echo mysql_result($query,$i,jiage);?></td><td><?php echo mysql_result($query,$i,kucunshuliang);?></td><td><?php echo mysql_result($query,$i,yonghupingjia);?></td>

<td width="30" align="center"><a href="shangpinxinxidetail.php?id=<?php echo mysql_result($query,$i,"id");?>">详细</a></td>
</tr>
<?php
}
}
?>
</table>
<p>以上数据共<?php echo $rowscount;?>条,
<input type="button" name="Submit2" onClick="javascript:window.print();" value="打印本页" style='border:solid 1px #000000; color:#666666' />
</p>
<p align="center"><a href="shangpinxinxilist.php?pagecurrent=1">首页</a>, <a href="shangpinxinxilist.php?pagecurrent=<?php echo $pagecurrent-1;?>">前一页</a> ,<a href="shangpinxinxilist.php?pagecurrent=<?php echo $pagecurrent+1;?>">后一页</a>, <a href="shangpinxinxilist.php?pagecurrent=<?php echo $pagecount;?>">末页</a>, 当前第<?php echo $pagecurrent;?>页,共<?php echo $pagecount;?>页 </p>





</TD>
</TR></TBODY></TABLE>
</TD>
<TD width=5>&nbsp;</TD></TR></TBODY></TABLE>
<?php include_once 'qtdown.php';?>
<!-- dfexnxxiaxng -->
</BODY></HTML>

原文地址:https://www.cnblogs.com/wanghaoning/p/14915505.html