不了解你的意思,可以说具体一点吗?

解决方案 »

  1.   

    就是说:1级主目录标题包括(树1、树2、树3)
    2级目录标题:树11、树12(属于树1)、树21、树22(属于树2)、树31(属于树3)如何将其标题(包括1、2目录)输出
      

  2.   

    table1:parent
           id   title  
           1    树1
           2    树2
           3    树3
           4    树4
    table2:child
           id   title  pid
           1    树11   1
           2    树12   1
           3    树21   2
           4    树22   2
           5    树31   3
    程序代码如下:<?
    include "include.php";//引用数据库连接的文件
    $mysql=new message;//创建数据库连接的类
    $mysql->link();
    $mysql->sqllink;
    $mysql->selectdata;$query1=mysql_query("select * from parent");
    //$query2=mysql_query("select * from child");
    $getid=$_GET['id'];
    $query2=mysql_query("select * from child where pid='$getid'");?>
    <table width="200" border="1" align="center" cellpadding="0" cellspacing="0">
    <?
    while($fetch1=mysql_fetch_array($query1)){
     $ptitle=$fetch1["title"];
     $id=$fetch1["id"];
         echo "<tr><td><a href='class.php?id=$id'>$ptitle</a></td></tr>";
     
     if(!$query2){
     break;
     }
     while($fetch2=mysql_fetch_array($query2)){
                    

      
    $ctitle=$fetch2["title"];
            echo "<tr><td>$ctitle</td></tr>";
    }
         
    }
    ?>
    </table>输出时属于树2、树3的子类却显示在树1下,我要是属于树1的子类显示在树1下,属于树2的子类显示在树2下,如此类推.
    如何改了?
    谢了
      

  3.   

    那位高手能指点一下小弟呢.
    感激不尽