Ver Mensaje Individual
  #18 (permalink)  
Antiguo 08/09/2014, 10:23
ocp001a
Colaborador
 
Fecha de Ingreso: mayo-2008
Ubicación: $MX['VZ']['Xalapa']
Mensajes: 3.005
Antigüedad: 16 años
Puntos: 528
Respuesta: Arrays sin guión al principio

Podrías meter todo en un arreglo y al final unir con implode.

Código PHP:
Ver original
  1. function get_path($id){
  2.    $result = mysql_query('SELECT name, parent_id FROM categorias WHERE id='.$id);
  3.    $row = mysql_fetch_array($result);
  4.    if ($row['parent_id'] != NULL){
  5.        $ret[]=get_path($row['parent_id']);
  6.        //echo ' > ';
  7.        //echo $row['name'];
  8.       $ret[]=$row['name'];
  9.    }
  10.    return $ret;
  11. }
  12.  
  13. $res=get_path(9);
  14.  
  15. echo implode(' > ',$res);