<?php require_once('Connections/niceanan.php'); ?>
<?php
$currentPage = $_SERVER["PHP_SELF"];$maxRows_s21 = 10;
$pageNum_s21 = 0;
if (isset($_GET['pageNum_s21'])) {
$pageNum_s21 = $_GET['pageNum_s21'];
}
$startRow_s21 = $pageNum_s21 * $maxRows_s21;mysql_select_db($database_niceanan, $niceanan);
$query_s21 = "SELECT * FROM image";
$query_limit_s21 = sprintf("%s LIMIT %d, %d", $query_s21, $startRow_s21, $maxRows_s21);
$s21 = mysql_query($query_limit_s21, $niceanan) or die(mysql_error());
$row_s21 = mysql_fetch_assoc($s21);if (isset($_GET['totalRows_s21'])) {
$totalRows_s21 = $_GET['totalRows_s21'];
} else {
$all_s21 = mysql_query($query_s21);
$totalRows_s21 = mysql_num_rows($all_s21);
}
$totalPages_s21 = ceil($totalRows_s21/$maxRows_s21)-1;$queryString_s21 = "";
if (!empty($_SERVER['QUERY_STRING'])) {
$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_s21") == false &&
stristr($param, "totalRows_s21") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_s21 = "&" . htmlentities(implode("&", $newParams));
}
}
$queryString_s21 = sprintf("&totalRows_s21=%d%s", $totalRows_s21, $queryString_s21);
?><html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head><body>
<table border="1" align="center">
<tr>
<td>name</td>
<td>images</td>
</tr>
<?php do { ?>
<tr>
<td><a href="123.html?recordID=<?php echo $row_s21['name']; ?>"> <?php echo $row_s21['name']; ?> </a> </td>
<td><img src="<?php echo $row_s21['images']; ?>"></td>
</tr>
<?php } while ($row_s21 = mysql_fetch_assoc($s21)); ?>
</table>
<br>
<table border="0" width="50%" align="center">
<tr>
<td width="23%" align="center"><?php if ($pageNum_s21 > 0) { // Show if not first page ?>
<a href="<?php printf("%s?pageNum_s21=%d%s", $currentPage, 0, $queryString_s21); ?>">第一页</a>
<?php } // Show if not first page ?>
</td>
<td width="31%" align="center"><?php if ($pageNum_s21 > 0) { // Show if not first page ?>
<a href="<?php printf("%s?pageNum_s21=%d%s", $currentPage, max(0, $pageNum_s21 - 1), $queryString_s21); ?>">前一页</a>
<?php } // Show if not first page ?>
</td>
<td width="23%" align="center"><?php if ($pageNum_s21 < $totalPages_s21) { // Show if not last page ?>
<a href="<?php printf("%s?pageNum_s21=%d%s", $currentPage, min($totalPages_s21, $pageNum_s21 + 1), $queryString_s21); ?>">下一页</a>
<?php } // Show if not last page ?>
</td>
<td width="23%" align="center"><?php if ($pageNum_s21 < $totalPages_s21) { // Show if not last page ?>
<a href="<?php printf("%s?pageNum_s21=%d%s", $currentPage, $totalPages_s21, $queryString_s21); ?>">最后一页</a>
<?php } // Show if not last page ?>
</td>
</tr>
</table>
记录 <?php echo ($startRow_s21 + 1) ?> 到 <?php echo min($startRow_s21 + $maxRows_s21, $totalRows_s21) ?> (总共 <?php echo $totalRows_s21 ?>
</body>
</html>
<?php
mysql_free_result($s21);
?>
附上源码…求解啊
<?php
$currentPage = $_SERVER["PHP_SELF"];$maxRows_s21 = 10;
$pageNum_s21 = 0;
if (isset($_GET['pageNum_s21'])) {
$pageNum_s21 = $_GET['pageNum_s21'];
}
$startRow_s21 = $pageNum_s21 * $maxRows_s21;mysql_select_db($database_niceanan, $niceanan);
$query_s21 = "SELECT * FROM image";
$query_limit_s21 = sprintf("%s LIMIT %d, %d", $query_s21, $startRow_s21, $maxRows_s21);
$s21 = mysql_query($query_limit_s21, $niceanan) or die(mysql_error());
$row_s21 = mysql_fetch_assoc($s21);if (isset($_GET['totalRows_s21'])) {
$totalRows_s21 = $_GET['totalRows_s21'];
} else {
$all_s21 = mysql_query($query_s21);
$totalRows_s21 = mysql_num_rows($all_s21);
}
$totalPages_s21 = ceil($totalRows_s21/$maxRows_s21)-1;$queryString_s21 = "";
if (!empty($_SERVER['QUERY_STRING'])) {
$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_s21") == false &&
stristr($param, "totalRows_s21") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_s21 = "&" . htmlentities(implode("&", $newParams));
}
}
$queryString_s21 = sprintf("&totalRows_s21=%d%s", $totalRows_s21, $queryString_s21);
?><html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head><body>
<table border="1" align="center">
<tr>
<td>name</td>
<td>images</td>
</tr>
<?php do { ?>
<tr>
<td><a href="123.html?recordID=<?php echo $row_s21['name']; ?>"> <?php echo $row_s21['name']; ?> </a> </td>
<td><img src="<?php echo $row_s21['images']; ?>"></td>
</tr>
<?php } while ($row_s21 = mysql_fetch_assoc($s21)); ?>
</table>
<br>
<table border="0" width="50%" align="center">
<tr>
<td width="23%" align="center"><?php if ($pageNum_s21 > 0) { // Show if not first page ?>
<a href="<?php printf("%s?pageNum_s21=%d%s", $currentPage, 0, $queryString_s21); ?>">第一页</a>
<?php } // Show if not first page ?>
</td>
<td width="31%" align="center"><?php if ($pageNum_s21 > 0) { // Show if not first page ?>
<a href="<?php printf("%s?pageNum_s21=%d%s", $currentPage, max(0, $pageNum_s21 - 1), $queryString_s21); ?>">前一页</a>
<?php } // Show if not first page ?>
</td>
<td width="23%" align="center"><?php if ($pageNum_s21 < $totalPages_s21) { // Show if not last page ?>
<a href="<?php printf("%s?pageNum_s21=%d%s", $currentPage, min($totalPages_s21, $pageNum_s21 + 1), $queryString_s21); ?>">下一页</a>
<?php } // Show if not last page ?>
</td>
<td width="23%" align="center"><?php if ($pageNum_s21 < $totalPages_s21) { // Show if not last page ?>
<a href="<?php printf("%s?pageNum_s21=%d%s", $currentPage, $totalPages_s21, $queryString_s21); ?>">最后一页</a>
<?php } // Show if not last page ?>
</td>
</tr>
</table>
记录 <?php echo ($startRow_s21 + 1) ?> 到 <?php echo min($startRow_s21 + $maxRows_s21, $totalRows_s21) ?> (总共 <?php echo $totalRows_s21 ?>
</body>
</html>
<?php
mysql_free_result($s21);
?>
附上源码…求解啊
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货