<?php
mysql_connect("localhost", "test", "test") or
die("Could not connect: " . mysql_error());
mysql_select_db("test");
$Result = mysql_query("SELECT * FROM images");
?><?php
$count=320;
while($count > 0)
{
?>
<div align="center">
<center>
<table border="0" width="600" height="180">
<?php
$Record = mysql_fetch_array($Result);
$str=sprintf("000%d.bmp",$Record[ID]);
$str=substr($str,-7);
$queryID=substr($str,0,3);
?> <tr>
<td width="672" height="180" align="center"><a href="retrieval.php?queryID=<?php echo "$queryID"; ?>"><img border="0" src="<?php echo "$str"; ?>" ></a>
<br><a href="retrieval.php?queryID=<?php echo "$queryID"; ?>"><?php echo "$str";?></a></td><?php
$Record = mysql_fetch_array($Result);
$str=sprintf("000%d.bmp",$Record[ID]);
$str=substr($str,-7);
$queryNum=substr($str,0,3);
?>
<td width="672" height="180" align="center"><a href="retrieval.php?queryID=<?php echo "$queryNum"; ?>"><img border="0" src="<?php echo "$str"; ?>" ></a>
<br><a href="retrieval.php?queryID=<?php echo "$queryNum"; ?>"><?php echo "$str";?></a></td>
</tr><?php
$count=$count-2;
}
?>
<?php
$Record = mysql_fetch_array($Result);
$str=sprintf("000%d.bmp",$Record[ID]);
$str=substr($str,-7);
$queryNo=substr($str,0,3);
?> <td width="672" height="180" align="center"><a href="retrieval.php?queryID=<?php echo "$queryNo"; ?>"><img border="0" src="<?php echo "$str"; ?>" ></a>
<br><a href="retrieval.php?queryID=<?php echo "$queryNo"; ?>"><?php echo "$str";?></a></td>
</table>
</center>
</div>
mysql_connect("localhost", "test", "test") or
die("Could not connect: " . mysql_error());
mysql_select_db("test");
$Result = mysql_query("SELECT * FROM images");
?><?php
$count=320;
while($count > 0)
{
?>
<div align="center">
<center>
<table border="0" width="600" height="180">
<?php
$Record = mysql_fetch_array($Result);
$str=sprintf("000%d.bmp",$Record[ID]);
$str=substr($str,-7);
$queryID=substr($str,0,3);
?> <tr>
<td width="672" height="180" align="center"><a href="retrieval.php?queryID=<?php echo "$queryID"; ?>"><img border="0" src="<?php echo "$str"; ?>" ></a>
<br><a href="retrieval.php?queryID=<?php echo "$queryID"; ?>"><?php echo "$str";?></a></td><?php
$Record = mysql_fetch_array($Result);
$str=sprintf("000%d.bmp",$Record[ID]);
$str=substr($str,-7);
$queryNum=substr($str,0,3);
?>
<td width="672" height="180" align="center"><a href="retrieval.php?queryID=<?php echo "$queryNum"; ?>"><img border="0" src="<?php echo "$str"; ?>" ></a>
<br><a href="retrieval.php?queryID=<?php echo "$queryNum"; ?>"><?php echo "$str";?></a></td>
</tr><?php
$count=$count-2;
}
?>
<?php
$Record = mysql_fetch_array($Result);
$str=sprintf("000%d.bmp",$Record[ID]);
$str=substr($str,-7);
$queryNo=substr($str,0,3);
?> <td width="672" height="180" align="center"><a href="retrieval.php?queryID=<?php echo "$queryNo"; ?>"><img border="0" src="<?php echo "$str"; ?>" ></a>
<br><a href="retrieval.php?queryID=<?php echo "$queryNo"; ?>"><?php echo "$str";?></a></td>
</table>
</center>
</div>
<?php
mysql_connect("localhost", "test", "test") or
die("Could not connect: " . mysql_error());
mysql_select_db("test");
if(!isset($page_num))$page_num = "12";//每页显示记录数;
$query = "SELECT COUNT(*) as count FROM images";
$OPresult = @mysql_query($query);
if ($OPresult)$rows = mysql_result($OPresult, 0, 'count');
else $rows = 0;
@mysql_free_result($OPresult);
if(!$q_num || $q_num <= 0)$q_num = 1;//起始页数;
$pages = ceil($rows/$page_num);
if($q_num >= $pages)$q_num = $pages;
$p_start = ($q_num-1)*$page_num;
$p_end = ($q_num-1)*$page_num + $page_num;
if($q_num == $pages) $p_end = $rows;
$query = "SELECT * FROM images LIMIT $p_start, $page_num";
$Result = mysql_query($query);
?>
<div align="center">
<center>
<form name="form1" method="post" action="">
<table border="0" width="600">
<?
while($Record = mysql_fetch_array($Result))
{
$str=sprintf("000%d.bmp",$Record[ID]);
$str=substr($str,-7);
$queryID=substr($str,0,3);
?>
<tr>
<td width="672" height="180" align="center"><a href="retrieval.php?queryID=<?php echo "$queryID"; ?>"><img border="0" src="<?php echo "$str"; ?>" ></a>
<br> <a href="retrieval.php?queryID=<?php echo "$queryID"; ?>"><?php echo "$str";?></a></td>
<?php
$Record = mysql_fetch_array($Result);
$str=sprintf("000%d.bmp",$Record[ID]);
$str=substr($str,-7);
$queryNum=substr($str,0,3);
?>
<td width="672" height="180" align="center"><a href="retrieval.php?queryID=<?php echo "$queryNum"; ?>"><img border="0" src="<?php echo "$str"; ?>" ></a>
<br> <a href="retrieval.php?queryID=<?php echo "$queryNum"; ?>"><?php echo "$str";?></a></td>
</tr>
<?php
}
?>
<tr>
<td colspan="2" align="center"><table width="98%" border="0" cellpadding="2" cellspacing="2">
<tr>
<td nowrap="nowrap">( 总共
<?=$rows?>
条
<?=$pages?>
页 当前第
<?=$q_num?>
页 )</td>
<td nowrap><a href='<?=$PHP_SELF?>' onClick='return GoToPage(1)'>最首页</a>
<a href='<?=$PHP_SELF?>' onClick='return NextPage(-1)'>上一页</a>
<a href='<?=$PHP_SELF?>' onClick='return NextPage(1)'>下一页</a>
<a href='<?=$PHP_SELF?>' onClick='return GoToPage(<?=$pages?>)'>最末页</a></td>
<td nowrap="nowrap"> <input name="page_num" type="hidden" size="2" value="<?=$page_num?>">
去第
<input name="q_num" type="text" size="2" value="<?=$q_num?>" onkeydown="if(event.keyCode==13){GoToPage(this.value);event.keyCode=0;return false;}">
页</td>
</tr>
</table></td>
</tr>
</table>
</form>
<SCRIPT language=JavaScript>
<!--//
var endPage = 0;
function winopen(theURL,vHeight,vWidth){
if(!vHeight)vHeight = 250;
if(!vWidth)vWidth = 450;
win=window.open(theURL, "JYSTAX<?=$_COOKIE["PHPSESSID"]?>", "resizable=yes,depended=yes,status=no,width="+vWidth+",height="+vHeight);
win.focus();
}
function NextPage(vPId){
vQnum = list_form.q_num.value;
vQnum = vQnum*1;
if(vQnum == endPage && vPId>0){
alert("已经是最后一页了!");
return false;
}
if(vQnum == 1 && vPId<0){
alert("已经是第一页了!");
return false;
}
list_form.q_num.value = vQnum + vPId;
list_form.submit();
return false;
}
function GoToPage(vPId){
vQnum = <?=($q_num)?$q_num:1?>;
if(vQnum == vPId == endPage == 1){
alert("只有一页!");
return false;
}
if(vQnum == vPId){
if(endPage == vPId)alert("已经是最后一页了!");
else if(1 == vPId)alert("已经是第一页了!");
else alert("已经是第 "+vPId+" 页了!");
return false;
}
list_form.q_num.value = vPId;
list_form.submit();
return false;
}
function OrderBy(vBy){
vOrderBy = list_form.order.value;
vDesc = list_form.desc.value;
if(vOrderBy != vBy)vDesc = "ASC";
else if(vDesc == "DESC")vDesc = "ASC";
else vDesc = "DESC";
list_form.order.value = vBy;
list_form.desc.value = vDesc;
list_form.submit();
return false;
}
var list_form = document.list;
var endPage = <?=($pages)?$pages:0?>;
//-->
</SCRIPT>
</center>
</div>
<?
$sql2 = "select * from tmly_text";
$result2 = mysql_query($sql2);
if($result2)
{
$rows=mysql_num_rows($result2);//获得数据数量
}
$pages=ceil($rows/5); //计算共有多少页
if (empty($offset)) //如果$offset没有赋值
{
$offset=0;
}
$sql="select * from tmly_text order by id desc limit $offset,5"; //要显示的数量,
$result=mysql_query($sql);
while($text=mysql_fetch_array($result))
{
?>
显示内容
<?
}
if($offset) //如果偏移量是0,不显示上一页的链接
{
$preoffset=$offset-5;
echo "<a href=index.php?offset=$preoffset>上一页</a>";
}
$nextoffset=$offset+5;
if (($pages!=0) && ($nextoffset<$rows))//如果偏移量不是0,显示下一页的链接
{
echo "<a href=index.php?offset=$nextoffset>下一页</a>";
}
?>