Salve. Sto utilizzando questa funzione:
E nella pagina dove voglio visualizzare i risultati inserisco questo codice: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; }
Tutto bene: i risultati vengono memorizzati nell'array ma il problema è che l'output è: Array ( [0] => Oro [1] => Ciao [2] => Bellissimi ). Perchè?codice:print_r(get_path('193'));
Come devo risolvere? Come faccio a stampare solo le voci (oro/ciao/bellissimi)?

Rispondi quotando