Ver Mensaje Individual
  #1 (permalink)  
Antiguo 02/10/2008, 11:59
Claugtrs
 
Fecha de Ingreso: febrero-2004
Mensajes: 134
Antigüedad: 20 años, 3 meses
Puntos: 0
while dentro de while

Hola foro acá otra vez intentando de nuevo una nueva aventura...
Tengo las siguientes tablas

FORMA
id_f
forma

MODELO
id_mod
id_f
modelo

MEDIDAS
id_m
medidas

MODXMED
id
id_mod
id_med

1ra consulta

Código PHP:
<? $registros=mysql_query("SELECT forma, modelo FROM modelo as m
join forma as f on f.id_f=m.id_f
join modxmed as mxm on mxm.id_mod=m.id_mod
where forma='rectangulares';"
,$conexion) or die("Problemas en el select:".mysql_error());
while (
$reg=mysql_fetch_array($registros))
{
echo 
$reg['modelo'];
echo 
"<br />";

//cierre while 1
mysql_close($conexion);
?>
Anda bárbaro me imprime los modelos por separado según la forma que pida
pero cuando quero pedir...

Consulta 2(combinada)

Código PHP:
<? $registros=mysql_query("SELECT forma, modelo FROM modelo as m
join forma as f on f.id_f=m.id_f
join modxmed as mxm on mxm.id_mod=m.id_mod
where forma='rectangulares';"
,$conexion) or die("Problemas en el select:".mysql_error());
while (
$reg=mysql_fetch_array($registros))
{
echo 
$reg['modelo'];
echo 
"<br />";

$medida=mysql_query("select medida from medida as med
join modxmed as mxm on mxm.id_med=med.id_m
where  mxm.id_mod="
.$reg['id_mod']);


while (
$reg_med=mysql_fetch_array($medida))


{
echo 
$reg_med['medida'];
echo 
"<br />";

   }

mysql_close($conexion);
?>
me imprime...


Código HTML:
Bahía

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/cbsite/domains/cbsite.com.ar/public_html/superpagina/index.php on line 43
Bahía

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /index.php on line 43
Bahía

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result /index.php on line 43
Aniversario

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result /index.php on line 43
Aniversario

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result /index.php on line 43
Aniversario

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result /index.php on line 43
Relax Simple

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result /index.php on line 43
No solo no me da las medidas que además me repite los modelos...
A ver amigos si alguien con la mente mas fresca puede sacarme de este brete...desde ya mil gracias por su tiempo.