在table1中有两个table,分别是table1,table2,在table1中用php写了
sql语句,进行基于oracle的数据库的查询,然后将查出的文件的题目
在table1中显示,因为记录不会只有一条,所以就要进行分页,也就是在
table1中要有份页的功能。(这里说的table均是指dreamweaver中的表)
相应的table2也要有份页的功能!
不知道这次有没有说明白

解决方案 »

  1.   

    给你一个例子吧!<?php
    session_start();
    $id1=$id;
    session_register("id1");
    ?>
    <html>
    <head>
    <title>常见问题解决办法</title>
    <STYLE type=text/css>BODY {FONT-SIZE: 9pt}
    DIV {FONT-SIZE: 9pt}
    TABLE {FONT-SIZE: 9pt}
    TR {fONT-SIZE: 9pt}
    TD {FONT-SIZE: 9pt}
    A:link {COLOR: black; TEXT-DECORATION: none}
    A:visited { COLOR: "#990000"; TEXT-DECORATION: none}
    A:hover {COLOR: white; TEXT-DECORATION: none}
    </STYLE>
    <script language='javaScript'>
    function opennews(url)
    {window.open (url, '', 'width=500, height=400, toolbar=no, status=no, menubar=no, resizable=yes, scrollbars=yes');
    }
    function load()
    {var name=navigator.appName
    var vers=navigator.appVersion
    if(name=='Netscape')
    {window.location.reload(true)
    }else
    {history.go(0)}
    }</script>
    </head>
    <body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
    <?php
    if(!isset($userid1))
    {
    echo "<script language=\"javascript\">";
    echo "alert(\"你还没有登录,请重新登录\");";
    echo "window.location=\"index.php\";";
    echo "</script>";
    }
    ?>
    <hr size="2" width="100%" color="#0099CC">
    <table width="100%" border="0" cellspacing="0" cellpadding="0" height="47">
      <tr> 
        <td align="left" nowrap><font color="#FF0000">本论坛使用说明: </font>本论坛讨论并解决华东公司所开发并投入使用的各种软件在使用中遇到的问题</td>
      </tr>
      <tr>
        <td align="center" nowrap><font color="#FF0000">我公司派专人维护,对您提出的问题及时解答,解决您工作中的问题!</font></td>
      </tr>
      <tr>
        <td align="center" nowrap>该论坛记录了郑州华东系统集成计算机公司所开发并投入使用的各种软件在使用中遇到的问题及解决方法</td>
      </tr>
    </table><hr size="2" width="100%" color="#990000"><table width="100%" border="0" cellpadding="0" cellspacing="0" height="22">
      <tr> 
        <td valign="middle" width="65" nowrap><img src="images/ball.gif" width="17" height="12"><a href="tiwen.php" target="_blank"><font color=blue>提 问</font></a></td>
        <td valign="middle" align="left" width="65" nowrap><img src="images/ball.gif" width="17" height="12"><a href=javascript:load()><font color=blue>刷 新</font></a></td>
        <td valign="middle" align="left" width="65" nowrap><img src="images/ball.gif" width="17" height="12"><a href="search.php" target="forum"><font color=blue>搜 索</font></a></td>
        <td valign="middle" align="left" width="85" nowrap><img src="images/ball.gif" width="17" height="12" ><a href="myprob.php" target="forum"><font color=blue>我的问题</font></a></td>
        <td valign="middle" align="left" width="85" nowrap><img src="images/ball.gif" width="17" height="12"><a href="myadvice.php" target="forum"><font color=blue>我的建议</font></a></td>
        <td valign="middle" align="left" width="85" nowrap><img src="images/ball.gif" width="17" height="12"><a href="javascript:opennews('trueanswer.php')"><font color=blue>正确方法</font></a></td>
        <td valign="top" align="left" width="333">&nbsp; </td>
      </tr>
    </table>
    <table width="100%" border="00" cellspacing="0" cellpadding="0" height="18" bordercolor="#99CCFF">
      <tr> 
        <td bgcolor="#C1E0FF" width="12"> </td>
        <td bgcolor="#C1E0FF" nowrap><font color="#000033"><b>问 题 标 题:</b></font></td>
        <th bgcolor="#C1E0FF" width="50" align="center" nowrap>人气</th>
        <th bgcolor="#C1E0FF" width="130" align="center" nowrap>提出时间</th>
        <th bgcolor="#C1E0FF" width="100" align="center" nowrap>提问单位</th>
      </tr>
    </table>
    <?php
    $tempnum=25;
    if(empty($id1))
    {
    switch($usertype)
    {
    case 1:
    $id1=2;
    break;
    case 2:
    $id1=23;
    break;
    case 3:
    $id1=62;
    break;
    default:
    $id1=2;
    break;
    }
    }
    if(empty($pagei))
    {
    $pagei=1;
    }
    if($pagei==1)
    $tempi=0;
    else
    $tempi=($pagei-1)*25;
    $conn=mysql_connect("localhost","root","122279li");
    mysql_select_db("hdsoft",$conn);
    $result1=mysql_query("select * from probinfo where probid=".$id1,$conn); 
    $totalnum=mysql_num_rows($result1);
    unset($row1);
    unset($result1);
    $query="select * from probinfo where probid=".$id1." order by probflag,probinfoid desc limit ".$tempi.",".$tempnum;
    $result=mysql_query($query,$conn);
    $tempnum=25;
    if($totalnum<=0)
    {
    echo "<script language\"javascript\">";
    echo "alert(\"该类问题现在还没有出现过\");";
    echo "</script>";
    $flag=1;
    }
    if($totalnum>=201)
    {
    $flag2=1;
    $totalnum=200;
    }
    if($totalnum/25<=1)
    {
    $i=1;
    }
    else
    {
    $i=floor($totalnum/25)+1;
    }
    if($flag!=1)
    {
    $colori=1;
    echo "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" height=\"18\" bordercolor=\"#99CCFF\">";
    while($row=mysql_fetch_array($result))
    {
    if($row[probflag]==1)
    $infoflag="<font color=green><b>√</b></font>";
    else
    $infoflag="<font color=red><b>?</b></font>";
    if($colori%2==0)
    $color="#CCCCCC";
    else
    $color="#FFFFFF";
    echo "<tr>";
    echo "<td bgcolor=\"".$color."\" width=\"12\">".$infoflag."</td>";
         echo "<td bgcolor=\"".$color."\" nowrap><a href=\"showinfo.php?probinfoid=".HTMLSpecialChars($row[probinfoid])."\" target=\"_blank\"><font color=blue>".chunk_split(HTMLSpecialChars($row[probintitle]),70,"<br>")."</font></a></td>";
    echo "<td bgcolor=\"".$color."\" width=\"50\" align=\"center\" nowrap>".HTMLSpecialChars($row[probvisi])."</td>";
         echo "<td bgcolor=\"".$color."\" width=\"130\" align=\"center\" nowrap>".HTMLSpecialChars($row[probprivdat])."</td>";
        echo "<td bgcolor=\"".$color."\" width=\"100\" align=\"center\" nowrap>".HTMLSpecialChars($row[probprivname])."</td>";
    echo "</tr>";
    $colori=$colori+1;
    }
    echo "</table>";
    echo "<table bgcolor=\"#C1E0FF\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" height=\"18\" width=\"100%\"><tr>";
    if($i==1)
    echo "当前问题共一页";
    else
    {
    if($pagei!=1)
    echo "<td width=\"60\" nowrap><a href=\"answer.php?pagei=".($pagei-1)."\" target=\"_self\">【上一页】</a></td>";
    else
    echo "<td width=\"60\" nowrap><font color=black>【上一页】</font></td>";
    for($tpagei=1;$tpagei<=$i;$tpagei++)
    {
    if($tpagei==$pagei)
    echo "<td width=\"20\" nowrap><font color=black>【".$tpagei."】</font></td>";
    else
    echo "<td width=\"20\" nowrap><a href=\"answer.php?pagei=".$tpagei."\" target=\"_self\">【".$tpagei."】</a></td>";
    }
    if($pagei!=$i)
    echo "<td width=\"60\" nowrap><a href=\"answer.php?pagei=".($pagei+1)."\" target=\"_self\">【下一页】</a></td>";
    else
    echo "<td width=\"60\" nowrap><font color=black>【下一页】</font></td>";
    if($flag2==1)
    echo "<td width=\"80\" nowrap><a href=\"more.php?pagei=".($pagei+1)."\" target=\"_blank\"><font color=red>【更多.....】</font></a></td>";
    }
    echo "<td>       共".$i."页   当前为第".$pagei."页</td></tr></table>";
    }
    ?>
    <hr width="100%">
    <table width="100%" border="0" height="43" cellspacing="0" cellpadding="0">
      <tr> 
        <td bgcolor="#CCCCCC" align="left" valign="top" height="19"> 
          <div align="center"><font color="#000000">Copyright<font size=4>&copy; </font>2002-2020  版权所有 
            </font> </div>
        </td>
      </tr>
      <tr> 
        <td bgcolor="#CCCCCC" align="left" valign="top" height="20"> 
          <div align="left"></div>
          <div align="center"><font color="#000000">地址:)</font></div>
        </td>
      </tr>
    </table>
    </body>
    </html>