Ver Mensaje Individual
  #5 (permalink)  
Antiguo 15/07/2015, 21:24
Angelito2076
 
Fecha de Ingreso: julio-2015
Mensajes: 9
Antigüedad: 8 años, 9 meses
Puntos: 0
Respuesta: Problemas al generar reportes creando PDF

antes que nada voy a pedir disculpas por que ya a estas alturas tengo una licuadora en ves de cabeza

lo que no me esta funcionando es traer los datos individualmente lo estoy haciendo en una pagina HTML y estoy en la misma instancia voy a dejar como están hasta el momento los códigos y por las dudas dos capturas de pantalla de la base de datos mysql calculo que dirán que soy medio lelo pero ya estoy mareado y no puedo resolver el problema.

una aclaración cuando pido el reporte de todos los datos almacenados en la db me los trae perfecto el tema es cuando quiero raer de a uno.

aquí dejo los códigos.

Registros.php

Código PHP:
Ver original
  1. <?php
  2.     include("conexion.php");
  3.    
  4.     $con = mysqli_connect($host,$user,$pw) or die("No se a podido conectar con el Host" . mysqli_error($link));
  5.    
  6.     mysqli_select_db($con,$db) or die("No se pudo conectar a la Base de Datos");
  7.    
  8.     $rst_ams = mysqli_query($con,"SELECT * FROM ams ORDER BY idForm desc");
  9.    
  10.     $num_registros = mysqli_num_rows($rst_ams);
  11.    
  12.         if ($num_registros=0)
  13.     {
  14.         echo "No Se Encontraron Registros En La Base De Datos";    
  15.    
  16.         mysqli_close($con);
  17.    
  18.         exit();
  19.     }
  20. ?>
  21.  
  22.  
  23. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  24. <html xmlns="http://www.w3.org/1999/xhtml">
  25. <head>
  26. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  27. <title>Listar Registros</title>
  28. <style type="text/css">
  29. body,td,th {
  30.     font-family: Arial, Helvetica, sans-serif;
  31. }
  32. </style>
  33. </head>
  34.  
  35. <body>
  36. <table width="75%" border="1" cellspacing="0" cellpadding="0">
  37.   <tr align="center">
  38.     <td width="11%" bgcolor="#0066FF">Formulario</td>
  39.     <td width="11%" bgcolor="#0066FF">Fecha</td>
  40.     <td width="14%" bgcolor="#0066FF">Nombre</td>
  41.     <td width="12%" bgcolor="#0066FF">Apellido</td>
  42.     <td width="10%" bgcolor="#0066FF">DNI</td>
  43.     <td width="17%" bgcolor="#0066FF">Empresa/Sector</td>
  44.     <td width="9%" bgcolor="#0066FF">Hora Ingreso</td>
  45.     <td width="16%" bgcolor="#0066FF">Hora Salida</td>
  46.     <td width="16%" bgcolor="#0066FF">&nbsp;</td>
  47.     <td width="16%" bgcolor="#0066FF">Reporte</td>
  48.   </tr>
  49.   <?php
  50.   while($fila = mysqli_fetch_array($rst_ams))
  51.   {
  52.   ?>
  53.   <tr>
  54.     <td><?php echo $fila["idForm"];?></td>
  55.     <td><?php echo $fila["Fecha"];?></td>
  56.     <td><?php echo $fila["Nombre"];?></td>
  57.     <td><?php echo $fila["Apellido"];?></td>
  58.     <td><?php echo $fila["DNI"];?></td>
  59.     <td><?php echo $fila["EmpSec"];?></td>
  60.     <td><?php echo $fila["HoraIn"];?></td>
  61.     <td><?php echo $fila["HoraSa"];?></td>
  62.     <td></td>
  63.     <td><form action="informe.php" method="post" name="reporte">
  64.               <input name="idForm" type="hidden" value="<?php echo $fila["idForm"];?>" />
  65.               <input name="Fecha" type="hidden" value="<?php echo $fila["Fecha"];?>" />
  66.               <input name="Nombre" type="hidden" value="<?php echo $fila["Nombre"];?>" />
  67.               <input name="Apellido" type="hidden" value="<?php echo $fila["Apellido"];?>" />
  68.               <input name="DNI" type="hidden" value="<?php echo $fila["DNI"];?>" />
  69.               <input name="EmpSec" type="hidden" value="<?php echo $fila["EmpSec"];?>" />
  70.               <input name="Tarea" type="hidden" value="<?php echo $fila["Tarea"];?>" />
  71.               <input name="HoraIn" type="hidden" value="<?php echo $fila["HoraIn"];?>" />
  72.               <input name="HoraSa" type="hidden" value="<?php echo $fila["HoraSa"];?>" />
  73.                   <input type="submit" value="Generar" alt="cambio" title="Generar Reporte PDF"/>
  74.                 </form></td>
  75.   </tr>
  76.     <?php
  77.   }
  78.   ?>
  79. </table>
  80. </body>
  81. </html>

este funciona en teoría bien me trae el reporte de todos los registros guardados como se ve en la imagen abajo.



por las dudas dejo la captura de la base de datos





y este es el muchachito que me hace doler la cabeza

informe.php

Código PHP:
Ver original
  1. <?php
  2.     include("conexion.php");
  3.    
  4.     $con = mysqli_connect($host,$user,$pw) or die("No se a podido conectar con el Host" . mysqli_error($link));
  5.    
  6.     mysqli_select_db($con,$db) or die("No se pudo conectar a la Base de Datos");
  7.    
  8.    
  9.     $rst_ams = mysqli_query($con,"SELECT * FROM ams WHERE idForm = '$_post[idForm]'");
  10.    
  11.    
  12.     $num_registros = mysqli_num_rows($rst_ams);
  13.    
  14.         if ($num_registros=0)
  15.     {
  16.         echo "No Se Encontraron Registros En La Base De Datos";    
  17.    
  18.         mysqli_close($con);
  19.    
  20.         exit();
  21.     }
  22. ?>
  23.  
  24. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  25. <html xmlns="http://www.w3.org/1999/xhtml">
  26. <head>
  27. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  28. <title>Documento sin título</title>
  29. <style type="text/css">
  30. body,td,th {
  31.     font-family: Arial, Helvetica, sans-serif;
  32. }
  33. </style>
  34. </head>
  35.  
  36. <body>
  37. <form action="procesar.php" method="post" name"form">
  38. <table width="1000" border="0" cellpadding="0" cellspacing="0">
  39.   <tr>
  40.     <td width="1219"><table width="100%" border="0" cellpadding="0" cellspacing="0">
  41.       <tr>
  42.         <td width="377"><img src="../graphic/milogo.jpg" alt="" width="267" height="63" /></td>
  43.         <td width="414" align="center"><strong>XXXX</strong></td>
  44.         <td width="210" align="left"><table width="100%" border="0" cellpadding="0" cellspacing="0">
  45. <?php
  46.   $fila = mysqli_fetch_array($rst_ams)
  47. ?>
  48.  
  49.           <tr>
  50.             <td width="61%">&nbsp;</td>
  51.             <td width="9%">N°</td>
  52.             <td width="30%"><?php echo $fila["idForm"];?></td>
  53.           </tr>
  54.         </table></td>
  55.       </tr>
  56.     </table></td>
  57.   </tr>
  58.   <tr>
  59.     <td align="center"><table width="1000" border="0" cellpadding="0" cellspacing="0">
  60.       <tr>
  61.         <td width="377"><strong>XXXXXXXXXXXXXXXXXXXXXXXXXXX</strong></td>
  62.         <td width="414" align="center"><strong>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</strong></td>
  63.         <td width="209">&nbsp;</td>
  64.       </tr>
  65.     </table></td>
  66.   </tr>
  67.   <tr>
  68.     <td>&nbsp;</td>
  69.   </tr>
  70.   <tr>
  71.     <td><strong>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</strong></td>
  72.   </tr>
  73.   <tr>
  74.     <td>&nbsp;</td>
  75.   </tr>
  76. </table>
  77. <p>&nbsp;</p>
  78. <table width="1010" border="0" cellspacing="0" cellpadding="0">
  79.   <tr>
  80.     <td width="140" height="18"><table width="1010" border="0" cellspacing="0" cellpadding="0">
  81.       <tr>
  82.         <td width="139">Fecha:</td>
  83.         <td width="135"><?php echo $fila["Fecha"];?></td>
  84.         <td width="483">&nbsp;</td>
  85.         <td width="253">&nbsp;</td>
  86.       </tr>
  87.     </table></td>
  88.   </tr>
  89.   <tr>
  90.     <td>&nbsp;</td>
  91.   </tr>
  92.   <tr>
  93.     <td>&nbsp;</td>
  94.   </tr>
  95.   <tr>
  96.     <td><table width="1010" border="0" cellspacing="0" cellpadding="0">
  97.       <tr>
  98.         <td width="139">Nombre:</td>
  99.         <td width="197"><?php echo $fila["Nombre"];?></td>
  100.         <td width="139">Apellido:</td>
  101.         <td width="209"><?php echo $fila["Apellido"];?></td>
  102.         <td width="139">D.N.I.</td>
  103.         <td width="187"><?php echo $fila["DNI"];?></td>
  104.       </tr>
  105.     </table></td>
  106.   </tr>
  107.   <tr>
  108.     <td>&nbsp;</td>
  109.   </tr>
  110.   <tr>
  111.     <td>&nbsp;</td>
  112.   </tr>
  113.   <tr>
  114.     <td height="18"><table width="1010" border="0" cellspacing="0" cellpadding="0">
  115.       <tr>
  116.         <td width="139">Empresa / Sector:</td>
  117.         <td width="871"><?php echo $fila["EmpSec"];?></td>
  118.         </tr>
  119.     </table></td>
  120.   </tr>
  121.   <tr>
  122.     <td>&nbsp;</td>
  123.   </tr>
  124.   <tr>
  125.     <td><table width="1010" border="0" cellspacing="0" cellpadding="0">
  126.       <tr>
  127.         <td width="139">Tarea:</td>
  128.         <td width="871"><?php echo $fila["Tarea"];?></td>
  129.       </tr>
  130.     </table></td>
  131.   </tr>
  132.   <tr>
  133.     <td>&nbsp;</td>
  134.   </tr>
  135.   <tr>
  136.     <td height="18"><table width="1010" border="0" cellspacing="0" cellpadding="0">
  137.       <tr>
  138.         <td width="139">Hora Entrada:</td>
  139.         <td width="271"><?php echo $fila["HoraIn"];?></td>
  140.         <td width="139">Hora Salida:</td>
  141.         <td width="461"><?php echo $fila["HoraSa"];?></td>
  142.         </tr>
  143.     </table></td>
  144.   </tr>
  145. </table>
  146.  
  147. </body>
  148. </html>

desde ya pido disculpas por las molestias