如何从mysql数据库中显示无序列表

时间:2017-11-20 05:07:28

标签: php

echo "<ul>";
$list  =    mysql_query("SELECT * FROM `abc` WHERE col2='0' ");
while($row = mysql_fetch_array($list))
{ 
    echo "<li>" . $row['col3']."</li>"; 
    echo "<ul>";     
    $list1  = mysql_query("SELECT * FROM `abc` WHERE `col2`= ".$row['col1'] ); 

    while($row = mysql_fetch_array($list1)) 
    {
        echo "<li>". $row['col3']."</li>";
        $list2  = mysql_query("SELECT * FROM `abc` WHERE `col2`= ".$row['col1'] ); 

        while($row = mysql_fetch_array($list2)) 
        {
            echo "<ul>"."<li>". $row['col3']."</li>"."</ul>";
            echo "<ul>";     
            $list3  = mysql_query("SELECT * FROM `abc` WHERE `col2`= ".$row['col1'] ); 

            while($row = mysql_fetch_array($list3)) 
            {           
                 echo "<ul>"."<li>". $row['col3']."</li>"."</ul>";
                 echo "<ul>";        
                 $list4  = mysql_query("SELECT * FROM `abc` WHERE `col2`= ".$row['col1'] ); 

                 while($row = mysql_fetch_array($list4))    
                 {
                     echo "<ul>"."<li>". $row['col3']."</li>"."</ul>";
                     echo "<ul>";       
                     $list5  = mysql_query("SELECT * FROM `abc` WHERE `col2`= ".$row['col1'] ); 

                     while($row = mysql_fetch_array($list5))    
                     {
                         echo "<ul>"."<li>". $row['col3']."</li>"."</ul>";

                         $list6  = mysql_query("SELECT * FROM `abc` WHERE `col2`= ".$row['col1'] ); 
                         while($row = mysql_fetch_array($list6))    
                         {
                             echo "<ul>"."<li>". $row['col3']."</li>"."</ul>";
                         }      
                    }
                }   
                echo "</ul>";   
           }
           echo "</ul>";
       }
   }
   echo "</ul>";
}

我这样编码但是D值没有正确显示所以请帮帮我

1 个答案:

答案 0 :(得分:0)

试试这个。 !!

File sceneFile=new File("scene.dodge");
FileInputStream fin=new FileInputStream(sceneFile);
ObjectInputStream in=new ObjectInputStream(fin);
return (Scene)(in.readObject());