Visualizzazione dei risultati da 1 a 2 su 2
  1. #1

    Non riesco a stampare i valori dell'array ma stampo l'array

    Salve. Sto utilizzando questa funzione:

    codice:
    // $node is the name of the node we want the path of
    function get_path($id)
            {
       // look up the parent of this node
       $result = mysql_query('SELECT padre,nome FROM catalogo_categorie '.
                              'WHERE id="'.$id.'";');
       $row = mysql_fetch_array($result);
    
       // save the path in this array
       $path = array();
    
       // only continue if this $node isn't the root node
       // (that's the node with no parent)
       if ($row['padre']!='0') {
           // the last part of the path to $node, is the name
           // of the parent of $node
           $path[] = $row['nome'];
    
           // we should add the path to the parent of this node
           // to the path
           $path = array_merge(get_path($row['padre']), $path);
       }
    
       // return the path
       return $path;
    }
    E nella pagina dove voglio visualizzare i risultati inserisco questo codice:

    codice:
    print_r(get_path('193'));
    Tutto bene: i risultati vengono memorizzati nell'array ma il problema è che l'output è: Array ( [0] => Oro [1] => Ciao [2] => Bellissimi ). Perchè?
    Come devo risolvere? Come faccio a stampare solo le voci (oro/ciao/bellissimi)?
    eCommerceRS.NET - Commerciante, vendi on-line!
    Il mio nick è mircov e non mirco!!!

  2. #2
    codice:
    $array = get_path('193');
    foreach($array as $key=>$val) {
        echo $val."
    \n";
    }
    E' la mia opinione ed io la condivido
    Non condivido la tua idea ma darei la vita perché tu la possa esprimere (Voltaire)
    Scrivi sul muro

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 © 2026 vBulletin Solutions, Inc. All rights reserved.