Ver Mensaje Individual
  #7 (permalink)  
Antiguo 02/07/2011, 15:42
Avatar de dvbeaumont
dvbeaumont
 
Fecha de Ingreso: marzo-2011
Ubicación: Caracas
Mensajes: 145
Antigüedad: 14 años
Puntos: 1
Respuesta: Mostrar registros concatenados

Me está funcionando lo que indicas, pero de la siguiente forma

Código PHP:
        $result_m=mysql_query("select * from t_marca WHERE id_subtipo=".$subtipo." ORDER BY id_marca",$linke); 
   while(
$row_m mysql_fetch_array($result_m)) { 
$desat=" "
if (
$row_m["id_marca"]=='4'){ $desat.="<img src='images/marca-1.png'  height='30' align='center'  border='0'/>"; } 
if (
$row_m["id_marca"]=='5'){ $desat.="<img src='images/marca-2.png'  height='30' align='center'  border='0'/>"; } 
if (
$row_m["id_marca"]=='6'){ $desat.="<img src='images/marca-3.png'  height='30' align='center'  border='0'/>"; } 
if (
$row_m["id_marca"]=='7'){ $desat.="<img src='images/marca-4.png'  height='30' align='center'  border='0'/>"; } 
if (
$row_m["id_marca"]=='8'){ $desat.="<img src='images/marca-5.png'  height='30' align='center'  border='0'/>"; } 
if (
$row_m["id_marca"]=='9'){ $desat.="<img src='images/marca-6.png'  height='30' align='center'  border='0'/>"; } 
if (
$row_m["id_marca"]=='10'){ $desat.="<img src='images/marca-7.png'  height='30' align='center'  border='0'/>"; } 
if (
$row_m["id_marca"]=='11'){ $desat.="<img src='images/marca-8.png'  height='30' align='center'  border='0'/>"; } 
if (
$row_m["id_marca"]=='12'){ $desat.="<img src='images/marca-9.png'  height='30' align='center'  border='0'/>"; } 
if (
$row_m["id_marca"]=='13'){ $desat.="<img src='images/marca-10.png'  height='30' align='center'  border='0'/>"; } 
if (
$row_m["id_marca"]=='14'){ $desat.="<img src='images/marca-11.png'  height='30' align='center'  border='0'/>"; } 
  
$marca=$row_m["id_marca"]; 
  
$result_e=mysql_query("select * from t_modelos WHERE  id_subtipo=".$subtipo." AND id_marca=".$marca." AND t_modelos.id_marca != 0 ORDER BY id_modelo ;",$linke)  or die( "Error en query: $linke, el error  es: " mysql_error() );   
        while (
$row_e mysql_fetch_array($result_e)){ 
        if(
$marca==$row_e["id_marca"]){ 
          echo
"<li><a href='detalle-producto.php?id_modelo=".$row_m["ma_name"]."'>".$row_m["ma_name"]."</a>"
echo
"<li><a href='detalle-producto.php?id_modelo=".$row_e["id_modelo"]."'>".$row_e["mo_titulo"]."</a>"
    } else { 
echo
""
    }}} 
   echo
"</li></ul></div></li>";} 
    
   echo
"</ul> 
                </li>"
;} 
Pero como poseo que el nombre de la marca o ma_name esté dentro del while entonces cada vez que despliega el modelo genera la marca! o sea cai en el mismo problema de antes! pero si se quitan las marcas que no poseen modelos.

Con esta opción

Código PHP:
 $result_m=mysql_query("select * from t_marca WHERE id_subtipo=".$subtipo." ORDER BY id_marca",$linke); 
   while(
$row_m mysql_fetch_array($result_m)) { 
$desat=" "
if (
$row_m["id_marca"]=='4'){ $desat.="<img src='images/marca-1.png'  height='30' align='center'  border='0'/>"; } 
if (
$row_m["id_marca"]=='5'){ $desat.="<img src='images/marca-2.png'  height='30' align='center'  border='0'/>"; } 
if (
$row_m["id_marca"]=='6'){ $desat.="<img src='images/marca-3.png'  height='30' align='center'  border='0'/>"; } 
if (
$row_m["id_marca"]=='7'){ $desat.="<img src='images/marca-4.png'  height='30' align='center'  border='0'/>"; } 
if (
$row_m["id_marca"]=='8'){ $desat.="<img src='images/marca-5.png'  height='30' align='center'  border='0'/>"; } 
if (
$row_m["id_marca"]=='9'){ $desat.="<img src='images/marca-6.png'  height='30' align='center'  border='0'/>"; } 
if (
$row_m["id_marca"]=='10'){ $desat.="<img src='images/marca-7.png'  height='30' align='center'  border='0'/>"; } 
if (
$row_m["id_marca"]=='11'){ $desat.="<img src='images/marca-8.png'  height='30' align='center'  border='0'/>"; } 
if (
$row_m["id_marca"]=='12'){ $desat.="<img src='images/marca-9.png'  height='30' align='center'  border='0'/>"; } 
if (
$row_m["id_marca"]=='13'){ $desat.="<img src='images/marca-10.png'  height='30' align='center'  border='0'/>"; } 
if (
$row_m["id_marca"]=='14'){ $desat.="<img src='images/marca-11.png'  height='30' align='center'  border='0'/>"; } 
          echo
"<li><a href='detalle-producto.php?id_modelo=".$row_m["ma_name"]."'>".$row_m["ma_name"]."</a>"
  
$marca=$row_m["id_marca"]; 
  
$result_e=mysql_query("select * from t_modelos WHERE  id_subtipo=".$subtipo." AND id_marca=".$marca." AND t_modelos.id_marca != 0 ORDER BY id_modelo ;",$linke)  or die( "Error en query: $linke, el error  es: " mysql_error() );   
        while (
$row_e mysql_fetch_array($result_e)){ 
        if(
$marca==$row_e["id_marca"]){ 
echo
"<li><a href='detalle-producto.php?id_modelo=".$row_e["id_modelo"]."'>".$row_e["mo_titulo"]."</a>"
    } else { 
echo
""
    }}} 
   echo
"</li></ul></div></li>";} 
    
   echo
"</ul> 
                </li>"
;} 
me deja las marcas cargadas asi no tengan modelo... La unica solucion que veo es que cada vez q se cargue un modelo se cargue la marca, pero no es util.