Visualizzazione dei risultati da 1 a 2 su 2
  1. #1
    Utente di HTML.it L'avatar di emu86
    Registrato dal
    May 2005
    Messaggi
    324

    Treeview che non funziona

    Ciao a tutti... ho fatto questo codice:
    Codice PHP:
    $sql "SELECT * FROM documenti_privati WHERE idu = '2' ORDER BY anno, tipo_doc, titolo ASC";
    $result1 mysql_query($sql$db);

    $sql "SELECT * FROM documenti_privati WHERE idu = '2' GROUP BY anno, tipo_doc";
    $result2 mysql_query($sql$db);

    $element1 0;
    $element2 0;

    while (
    $row1 mysql_fetch_array($result1)) {
        
    $id[$element1] = $row1['ID'];
        
    $letto[$element1] = $row1['letto'];
        
    $titolo[$element1] = $row1['titolo'];
        
    $tipo_doc[$element1] = $row1['tipo_doc'];
        
    $anno[$element1] = $row1['anno'];
        
    $element1++;
    }

    while (
    $row2 mysql_fetch_array($result2)) {
        
    $v_anno[$element2] = $row2['anno'];
        
    $v_tipodoc[$element2] = $row2['tipo_doc'];
        
    $element2++;
    }

    $treeview .= "<ul class=\"treeview\">";

    for (
    $i 0$i <= $element2$i++) {
        
    $treeview .= "[*]<a href=\"#\">$v_anno[$i]</a>";
        
    $treeview .= "[*]<ul>";

        for (
    $l 0$l <= $element2$l++) {
            if (
    $v_anno[$i] == $anno[$l]) {
                
    $treeview .= "[*]<a href=\"#\">$v_tipodoc[$l]</a>";
                
    $treeview .= "[*]<ul>";
                for (
    $m 0$m <= $element1$m++) {
                    if (
    $v_tipodoc[$l] == $tipo_doc[$m]) {
                        
    $treeview .= "[*]<a href=\"$id[$m]\">$titolo[$m]</a>";
                    }
                }
            }
                
            
    $treeview .= "[/list]";
        }

        
    $treeview .= "[/list]";
    }

    $treeview .= "[/list]";

    echo 
    $treeview
    ma non funziona correttamente in quanto la struttura che voglio è questa:
    codice:
    anno
      cartella
        file
    questo è il codice html che mi salta fuori:
    codice:
    <ul class="treeview">[*]2007[*]<ul>[*]24f[*]<ul>[*]ID3-TD24f-a2007[*]ID4-TD24f-a2007
    [*]ID1-TD24f-a2008[/list][*]f24[*]<ul>[*]ID2-TDf24-a2007[*]ID6-TDf24-a2007[*]ID7-TDf24-a2007
    [*]ID5-TDf24-a2008[*]ID8-TDf24-a2008[/list][*]24f[*]<ul>[*]ID3-TD24f-a2007[*]ID4-TD24f-a2007
    [*]ID1-TD24f-a2008[/list][*]f24[*]<ul>[*]ID2-TDf24-a2007[*]ID6-TDf24-a2007[*]ID7-TDf24-a2007
    [*]ID5-TDf24-a2008[*]ID8-TDf24-a2008[/list][*][*]<ul>[*][/list][/list]
    [*]2007[*]<ul>[*]24f[*]<ul>[*]ID3-TD24f-a2007[*]ID4-TD24f-a2007[*]ID1-TD24f-a2008
    [/list][*]f24[*]<ul>[*]ID2-TDf24-a2007[*]ID6-TDf24-a2007[*]ID7-TDf24-a2007[*]ID5-TDf24-a2008
    [*]ID8-TDf24-a2008[/list][*]24f[*]<ul>[*]ID3-TD24f-a2007[*]ID4-TD24f-a2007[*]ID1-TD24f-a2008
    [/list][*]f24[*]<ul>[*]ID2-TDf24-a2007[*]ID6-TDf24-a2007[*]ID7-TDf24-a2007[*]ID5-TDf24-a2008
    [*]ID8-TDf24-a2008[/list][*][*]<ul>[*][/list][/list][*]2008
    [*]<ul>[/list][/list][/list][/list][/list][/list][*]2008
    [*]<ul>[/list][/list][/list][/list][/list][/list][*][*]<ul>
    [/list][/list][/list][/list][/list][/list][/list]
    Come posso fare per farlo funzionare correttamente, con la struttura che mi serve? grazie mille...

  2. #2
    Utente di HTML.it L'avatar di emu86
    Registrato dal
    May 2005
    Messaggi
    324
    uppo...

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.