Ver Mensaje Individual
  #11 (permalink)  
Antiguo 15/08/2013, 12:24
Erick_MD9
 
Fecha de Ingreso: julio-2013
Ubicación: México
Mensajes: 361
Antigüedad: 10 años, 9 meses
Puntos: 55
Respuesta: Como utilizar dos consultas en While

Ok, te doy una solucion, de hecho es una mala solucion.

Código PHP:
Ver original
  1. $result2 = mysql_query("SELECT * FROM identificacion  $where  $opciones )", $bd) or die('ERROR: '.mysql_error());
  2. while($row2= mysql_fetch_assoc($result2))
  3. {
  4.     $ID=$row2[id];
  5.     $result = mysql_query("SELECT * FROM cierre where id='$ID'", $bd) or die('ERROR: '.mysql_error());
  6.     while($row= mysql_fetch_assoc($result))
  7.     {
  8.     if($row['D1']=="1"){$B++;}
  9.     if($row['D1']=="2"){$C++;}
  10.     if($row['D1']=="3"){$D++;}
  11.     if($row['D1']=="4"){$E++;}
  12.     if($row['D1']=="5"){$F++;}
  13.     if($row['D1']=="6"){$G++;}
  14.     if($row['D1']==0){$A++;}
  15.     }
  16. }
Lo correcto es hacer la consulta algun JOIN de mysql.
Investiga un poco al respecto.

Saludos.