Ver Mensaje Individual
  #2 (permalink)  
Antiguo 15/09/2010, 08:24
Avatar de Perr0
Perr0
 
Fecha de Ingreso: mayo-2005
Ubicación: Santiago de Chile, Chile
Mensajes: 676
Antigüedad: 19 años
Puntos: 79
Respuesta: Ayuuuda!!!! Como imprimir en una tabla multiples registro de historial

Hola Triste hombre

mira hay veces que tengo problemas con la compresión y en otras ocasiones con la mala redacción, tratare de darte una mano:

Código PHP:
Ver original
  1. <table border="1">
  2. <!--SE ELIMINARION CIERTOS ATRIBUTOS QUE <TH> DA POR DEFECTO
  3. SE AGREGA THEAD Y TBODY -->
  4.   <tr style="background-color:#0099FF">
  5.     <th valign="top" width="100">N° de pago</th>
  6.     <th valign="top" width="300">Nombre</th>
  7.     <th valign="top" width="200">Concepto</th>
  8.     <th valign="top" width="70">periodo</th>
  9.     <th valign="top" width="150">cantidad</th>
  10.     <th valign="top" width="100">N° de factura</th>
  11.     <th valign="top" width="80">Fecha</th>
  12.     <th valign="top" width="80">Hora</th>
  13.     <th valign="top" width="80">Funcion</th>
  14.   </tr><!-- ESTE TR NO ESTABA, AGREGADO POR Perr0 -->
  15. <?
  16. //ESTA PARTE TU SABES COMO CONECTAS
  17. require_once('Connections/cn.php');
  18. $valor=$_GET["ID"];
  19.  
  20. $cn=mysql_connect("localhost","root","");
  21. $conectar_bd=mysql_select_db($database_cn,$cn);
  22.  
  23. //CON ESTO TENEMOS UNA CONSULTA CON LAS DOS TABLAS
  24. $consulta="SELECT * FROM pagos INNER JOIN ID=ID_alumno WHERE ID_alumno='$valor'";
  25.  
  26. $query=mysql_query($consulta);
  27. while($res=mysql_fetch_assoc($query)){
  28.     print "<tr>";
  29.     print "<td>".$res['ID']."</td>";
  30.     print "<td>".$res['nombre']."</td>";
  31.     print "<td>".$res['conceptopago']."</td>";
  32.     print "<td>".$res['periodopago']."</td>";
  33.     print "<td>".$res['cantidad']."</td>";
  34.     print "<td>".$res['facorec']."</td>";
  35.     print "<td>".$res['fechapago']."</td>";
  36.     print "<td>".$res['hora']."</td>";
  37.     print "<td width=\"55\" valign=\"top\">
  38.     <a href=\"adminpagos.php?ID=$res['ID']\" title=\"Regustrar Pago\">
  39.     <img src=\"pago.bmp\" width=\"24\" height=\"24\" border=\"0\"></a></td>";
  40.     print "</tr>";
  41. }
  42.  
  43. ?>
  44. </table>

espero te sirva, la idea es armar bien el codigo y no estabas usando while para armar el bucle de la consulta,
se me olvido agregar thead y tbody, pero es cosa tuya

salu2