Ver Mensaje Individual
  #6 (permalink)  
Antiguo 09/03/2010, 09:46
gastonemen
 
Fecha de Ingreso: octubre-2009
Mensajes: 53
Antigüedad: 14 años, 6 meses
Puntos: 0
Respuesta: ayuda bukle tabla td php

Cita:
Iniciado por abimaelrc Ver Mensaje
Tienes que usar un bucle para recorrer todas las filas de la base de datos. Usa por ejemplo while para ir recorriendo la tabla de la base de datos.
Código PHP:
Ver original
  1. $consulta = mysql_query("aqui va tu consulta") or die(mysql_error);
  2. while($row = mysql_fetch_assoc($consulta)){
  3.   //aqui va tu código para ver la información.
  4. }
Código HTML:
<table width="50" border="0" cellspacing="5">
  <tr>
    <td>Tipo</td>
    <td>Marca</td>
    <td>Diseño</td>
    <td>Cantidad</td>
    <td>N° factura</td>
    <td>Fecha Ingreso</td>
    
  </tr>
  <tr>
  <?php
  
   $sql_stock=mysql_query("select id,tipo,marca,disenio,cantidad,n_factura,fecha from stock where id='$id_ingreso'",$link);
		
		while($row=mysql_fetch_array($sql_stock)){
		$id=$row['id'];
	   $tipo1=$row['tipo'];
       $marca1=$row['marca'];
       $disenio1=$row['disenio'];
       $cantidad1=$row['cantidad'];
       $n_factura1=$row['n_factura'];
       $fecha1=$row['fecha'];
       
  ?>
    <td><?=$tipo1?></td>
    <td><?=$marca1?></td>
    <td><?=$disenio1?></td>
    <td><?=$cantidad1?></td>
    <td><?=$n_factura1?></td>
    <td><?=$fecha1?></td>
    <td>
    <form action=ingresar_stock.php method=get>
    <input name="borrar" type="hidden" id="textfield" size="5" value=<?= $id?>/>
    <input type="submit" name="quehacer" value="Eliminar" />
    </td>
    </form>  
  </tr>
   
<?php }?>
</table> 
lo tengo, pero esto me muestra una vez lo que ingrese anterior mente, si ingreso algo nuevo vuelvo con header y me muestra nuevamente lo ultimo insertado y se pierde lo anterior.

sera posible hacer lo que pregunto?