Ver Mensaje Individual
  #5 (permalink)  
Antiguo 14/09/2010, 10:10
felipe_ceg
 
Fecha de Ingreso: noviembre-2008
Mensajes: 112
Antigüedad: 15 años, 6 meses
Puntos: 1
Respuesta: ayuda con un ciclo

Cita:
Iniciado por Sourcegeek Ver Mensaje
Código PHP:
$consulta mysql_query("SELECT * FROM tutabla");

while (
$row mysql_fetch_assoc($consulta)) {
    echo 
$row['id'].':<br>';
    
$consulta2 mysql_query("SELECT * FROM tutabla WHERE id = '".$row['id']."'");
    while (
$row2 mysql_fetch_assoc($consulta2)) {
        echo 
$row2['fecha'].'<br>';
    }

Se me ocurre que asi puede ser ;)
Para hacer la tabla, necesitas saber HTML basico y ya que lo sepas, podras cotinuar con tu proyecto..

Saludos!

estimado asi es como me quedo,
aun no hace lo que quiero, porque los dats que me despliega son las fechas hacia abajo, y lo que deberia hacer es todas las fechas distintas guardarlas hacia el lado en la tabla...

saludos y gracias nuevamente

Código PHP:
Ver original
  1. <?
  2. include ("pags/conectar.php");
  3. $consulta = mysql_query("SELECT * FROM bo_checklist order by fec_chec");
  4.  
  5. while ($row = mysql_fetch_assoc($consulta)) {
  6.     $a= $row['cod_cona'].':<br>';
  7.    
  8.     $consulta2 = mysql_query("SELECT * FROM bo_checklist WHERE cod_cona = '".$row['cod_cona']."' order by fec_chec");
  9.     while ($row2 = mysql_fetch_assoc($consulta2)) {
  10.         $b= $row2['fec_chec'].'<br>'; ?>
  11.        
  12.         <table width="100" height="18" border="1" align="center"  cellpadding="0" cellspacing="0">
  13.               <tr bgcolor="#CCCCCC">
  14.     <td width="4"  align="center"><? echo "$a"; ?></td>
  15.     <td width="5"  align="center"><? echo "$b"; ?></td>
  16.     <td width="5"  align="center"><? echo "$row2[fec_chec]"; ?></td>
  17.     <td width="5"  align="center"><? echo "$row2[fec_chec]"; ?></td>
  18.     <td width="5"  align="center"><? echo "$row2[fec_chec]"; ?></td>
  19.     </tr></table>
  20.  
  21. <?  }
  22.  } ?>