<?php
session_start();
include("conn/conn.php");
include("top.php");
?>
<style type="text/css">
<!--
.style1 {color: #990000}
-->
</style>
<table width="766" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="229" valign="top" bgcolor="#F0F0F0"><?php include("left.php");?></td>
<td width="561" align="center" valign="top" bgcolor="#FFFFFF"><table width="550" height="20" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td> </td>
</tr>
</table>
<?php
$jdcz=$_POST[jdcz];
$name=$_POST[name];
if($jdcz!="" or isset($_GET[name]) ){
if (isset($_GET[name])) { $name = $_GET[name];}
$sql1=mysql_query("select count(*) as total from tb_shangpin where mingcheng like '%".$name."%'",$conn);
$info1=mysql_fetch_array($sql1);
$total=$info1[total];
$pagesize=10;
if ($total<=$pagesize){
$pagecount=1;
}
if(($total%$pagesize)!=0){
$pagecount=intval($total/$pagesize)+1;
}else{
$pagecount=$total/$pagesize;
}
if(($_GET[page])==""){
$page=1;
}else{
$page=intval($_GET[page]);
}
$sql=mysql_query("select * from tb_shangpin where mingcheng like '%".$name."%' order by addtime desc limit ".($page-1)*$pagesize.",$pagesize",$conn);
}
$info=mysql_fetch_array($sql);
if($info==false){
echo "<script language='javascript'>alert('本站暂无类似产品!');history.go(-1);</script>";
}
else{
?>
<table width="530" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr bgcolor="#FFEDBF">
<td width="99" height="25"><div align="center" style="color: #990000">名称</div></td>
<td width="56"><div align="center" style="color: #990000">剩余数量</div></td>
<td width="44"><div align="center" style="color: #990000">单位</div></td>
<td width="159"><div align="center" style="color: #990000">规格</div></td>
<td width="71"><div align="center" style="color: #990000">上架时间</div></td>
<td width="46"><div align="center" style="color: #FFFFFF"><span class="style1"></span></div></td>
<td width="47"><div align="center" style="color: #990000">操作</div></td>
</tr>
<?php
do{
?>
<tr bgcolor="#FFFFFF">
<td height="25"><div align="center"><?php echo $info[mingcheng];?></div></td>
<td height="25"><div align="center"><?php echo $info[shuliang];?></div></td>
<td height="25"><div align="center"><?php echo $info[xinghao];?></div></td>
<td height="25"><div align="center"><?php echo $info[jianjie];?></div></td>
<td height="25"><div align="center"><?php echo $info[addtime];?></div></td>
<td height="25"><div align="center"><a href="lookinfo.php?id=<?php echo $info[id];?>">查看</a></div></td>
<td height="25"><div align="center"><a href="addgouwuche.php?id=<?php echo $info[id];?>" onClick="javascript:history.back();">领用</a></div></td>
</tr>
<?php
}while($info=mysql_fetch_array($sql));
}
?>
</table>
<table width="530" height="25" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><div align="right"> 共有该类商品
<?php
echo $total;
?>
件 每页显示 <?php echo $pagesize;?> 件 第 <?php echo $page;?> 页/共 <?php echo $pagecount; ?> 页
<?php
if($page>=2)
{
?>
<a href="findsp.php?name=<?php echo $name;?>&page=1" title="首页"><font face="webdings"> 9 </font></a> <a href="findsp.php?name=<?php echo $name;?>&page=<?php echo $page-1;?>" title="前一页"><font face="webdings"> 7 </font></a>
<?php
}
if($pagecount<=4){
for($i=1;$i<=$pagecount;$i++){
?>
<a href="findsp.php?name=<?php echo $name;?>&page=<?php echo $i;?>"><?php echo $i;?></a>
<?php
}
}else{
for($i=1;$i<=4;$i++){
?>
<a href="findsp.php?name=<?php echo $name;?>&page=<?php echo $i;?>"><?php echo $i;?></a>
<?php }?>
<a href="findsp.php?name=<?php echo $name;?>&page=<?php echo $page+1;?>" title="后一页"><font face="webdings"> 8 </font></a> <a href="findsp.php?name=<?php echo $name;?>&page=<?php echo $pagecount;?>" title="尾页"><font face="webdings"> : </font></a>
<?php }?>
</div></td>
</tr>
</table>
</td>
</tr>
</table>
<?php
include("bottom.php");
?>
我的“检索数据及相关分页代码
原创
©著作权归作者所有:来自51CTO博客作者mgjglg的原创作品,请联系作者获取转载授权,否则将追究法律责任
下一篇:PHP JS检索自动数据提示
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
Hibernate的检索及五种数据检索方式
Hibernate的五种数据检索方式
数据库 记录 customer Hibernate 检索方式 -
DataTable数据进行排序、检索、合并、分页、统计
DataTable数据进行排序、检索、合并、分页、统计
检索 分页 DataTable 合并 数据进行排序 -
代码生成相关工具及技术javascript 对象图 代码生成 模板引擎 代码生成器