每页显示多少记录我用$maxRows_Recordset1 = 5 来限制
每行显示多少条记录怎么写?

解决方案 »

  1.   

    <?php
    require './config.php'; 
    $maxRows_rs = 13;
    $pageNum_rs = 0;
    if (isset($_GET['pageNum_rs'])) {
      $pageNum_rs = $_GET['pageNum_rs'];
    }
    $startRow_rs = $pageNum_rs * $maxRows_rs;mysql_select_db($database_conn, $conn);
    $query_rs = "SELECT * FROM `news`order by `id` desc";
    $query_limit_rs = sprintf("%s LIMIT %d, %d", $query_rs, $startRow_rs, $maxRows_rs);
    $rs = mysql_query($query_limit_rs, $conn) or die(mysql_error());
    $row_rs = mysql_fetch_assoc($rs);if (isset($_GET['totalRows_rs'])) {
      $totalRows_rs = $_GET['totalRows_rs'];
    } else {
      $all_rs = mysql_query($query_rs);
      $totalRows_rs = mysql_num_rows($all_rs);
    }
    $totalPages_rs = ceil($totalRows_rs/$maxRows_rs)-1;$queryString_rs = "";
    if (!empty($_SERVER['QUERY_STRING'])) {
      $params = explode("&", $_SERVER['QUERY_STRING']);
      $newParams = array();
      foreach ($params as $param) {
        if (stristr($param, "pageNum_rs") == false && 
            stristr($param, "totalRows_rs") == false) {
          array_push($newParams, $param);
        }
      }
      if (count($newParams) != 0) {
        $queryString_rs = "&" . htmlentities(implode("&", $newParams));
      }
    }
    $queryString_rs = sprintf("&totalRows_rs=%d%s", $totalRows_rs, $queryString_rs);
    $chuli=$row_rs['chuli'];
    ?>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title><?php echo $webtitle ?>--新闻列表</title>
    <link href="css1.css" rel="stylesheet" type="text/css">
    </head><body>
    <table border="0" cellpadding="0" cellspacing="0" width="761">
      <!-- fwtable fwsrc="index.png" fwbase="index.jpg" fwstyle="Dreamweaver" fwdocid = "2102970714" fwnested="0" -->
      <tr>
        <td width="189"><img src="images/spacer.gif" width="189" height="1" border="0" alt=""></td>
        <td width="20"><img src="images/spacer.gif" width="20" height="1" border="0" alt=""></td>
        <td width="155"><img src="images/spacer.gif" width="155" height="1" border="0" alt=""></td>
        <td width="396"><img src="images/spacer.gif" width="396" height="1" border="0" alt=""></td>
        <td width="10"><img src="images/spacer.gif" width="1" height="1" border="0" alt=""></td>
      </tr>
      <tr>
        <td colspan="4" rowspan="6"><?php include('top.php'); ?></td>
        <td><img src="images/spacer.gif" width="1" height="3" border="0" alt=""></td>
      </tr>
      <tr>
        <td><img src="images/spacer.gif" width="1" height="32" border="0" alt=""></td>
      </tr>
      <tr>
        <td><img src="images/spacer.gif" width="1" height="32" border="0" alt=""></td>
      </tr>
      <tr>
        <td><img src="images/spacer.gif" width="1" height="33" border="0" alt=""></td>
      </tr>
      <tr>
        <td><img src="images/spacer.gif" width="1" height="32" border="0" alt=""></td>
      </tr>
      <tr>
        <td><img src="images/spacer.gif" width="1" height="31" border="0" alt=""></td>
      </tr>
      <tr>
        <td rowspan="5"><?php include('left.php'); ?></td>
        <td colspan="3"><img name="index_r7_c2" src="images/index_r7_c2.jpg" width="571" height="17" border="0" alt=""></td>
        <td><img src="images/spacer.gif" width="1" height="17" border="0" alt=""></td>
      </tr>
      <tr>
        <td colspan="3" rowspan="4" valign="top"><table width="571" border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
            <td width="571" colspan="4" class="td1"><table width="569" border="0" cellspacing="0" cellpadding="0">
                <tr class="toptitle">
                  <td colspan="2"><img src="images/spacer.gif" width="1" height="1"></td>
                </tr>
                <?php if ($totalRows_rs == 0) { // Show if recordset empty ?>
                <tr align="center">
                  <td colspan="2" >没有任何信息</td>
                </tr>
                <?php } // Show if recordset empty ?>
                <?php do { ?>
                <?php if ($totalRows_rs > 0) { // Show if recordset not empty ?>
                <tr align="center">
                  <td width="402" height="45" class="trclass"><a href="readnews.php?id=<? echo $row_rs['id'];?>"><?php echo $row_rs['title']; ?></a></td>
                  <td width="167" class="trclass"><?php echo $row_rs['addtime']; ?></td>
                </tr>
                <?php } // Show if recordset not empty ?>
                <?php } while ($row_rs = mysql_fetch_assoc($rs)); ?>
                <tr align="center">
                  <td colspan="2"><?php if ($pageNum_rs > 0) { // Show if not first page ?>
                      <a href="<?php printf("%s?pageNum_rs=%d%s", $currentPage, 0, $queryString_rs); ?>">第一页</a>
                      <?php } // Show if not first page ?>
                      <a href="<?php printf("%s?pageNum_rs=%d%s", $currentPage, max(0, $pageNum_rs - 1), $queryString_rs); ?>">前一页</a> <a href="<?php printf("%s?pageNum_rs=%d%s", $currentPage, min($totalPages_rs, $pageNum_rs + 1), $queryString_rs); ?>">下一页</a>
                      <?php if ($pageNum_rs < $totalPages_rs) { // Show if not last page ?>
                      <a href="<?php printf("%s?pageNum_rs=%d%s", $currentPage, $totalPages_rs, $queryString_rs); ?>">尾页</a>
                      <?php } // Show if not last page ?>
                共<?php echo $totalRows_rs ?> 记录 本页从 <?php echo ($startRow_rs + 1) ?>至<?php echo min($startRow_rs + $maxRows_rs, $totalRows_rs) ?></td>
                </tr>
            </table></td>
          </tr>
        </table></td>
        <td><img src="images/spacer.gif" width="1" height="13" border="0" alt=""></td>
      </tr>
      <tr>
        <td><img src="images/spacer.gif" width="1" height="140" border="0" alt=""></td>
      </tr>
      <tr>
        <td><img src="images/spacer.gif" width="1" height="30" border="0" alt=""></td>
      </tr>
      <tr>
        <td><img src="images/spacer.gif" width="1" height="137" border="0" alt=""></td>
      </tr>
    </table>
    <?php include('bottom.php'); ?>
    </body>
    </html>$maxRows_rs = 13;//没页记录的条数
    $pageNum_rs = 0;//开始显示的页数
      

  2.   

    有个插件(Dreamweaver MX 版的),下班后回家发给你。
    有需要的朋友,请留下你的衣没了,呵呵...^-^
      

  3.   

    发了,注意查收,主题是:你要的插件-DREAMWEAVER实现PHP多列重复区域发到 [email protected] 的邮件被退回。楼主的问题解决了,不需要这个插件了吗?