Ver Mensaje Individual
  #18 (permalink)  
Antiguo 23/11/2015, 15:45
edgaralcalaserra
 
Fecha de Ingreso: octubre-2015
Ubicación: ciudad juarez
Mensajes: 90
Antigüedad: 8 años, 7 meses
Puntos: 1
Respuesta: consulta con where

me funciono des esta manera pero tengo un problema

las tablas son de un preceso de produccion y el producto puede ser que apenas este en el primer preceso y por lo tanto en la siguiente tabla estara vacio los datos si, el problema es que si en la tabla core coil no hay datos al momento de hacer la consulta no me da ningun dato

Código PHP:
Ver original
  1. <?php
  2. //insertamos los headers que van a generar el archivo excel
  3. header('Content-type: application/vnd.ms-excel');
  4. //en filename vamos a colocar el nombre con el que el archivo xls sera generado
  5. header("Content-Disposition: attachment; filename=consulta.xls");
  6. header("Pragma: no-cache");
  7. header("Expires: 0?");
  8. //recogemos la variable de fecha con la que limitaremos la cinsulta.
  9.  
  10. //hacemos la conexion al servidor MySql
  11. $conexion = mysql_connect ("localhost", "root","");
  12.  mysql_select_db ("eaton", $conexion);
  13. //realizamos la consulta
  14. //$tipo = $_POST['tipo'];
  15. //$dato = $_POST['dato'];
  16. //$inicio = $_POST['inicio'];
  17. //$final = $_POST['final'];
  18.  
  19. $query=mysql_query ("SELECT * FROM info WHERE schedule ='s750000'");
  20. $qye=mysql_query ("SELECT * FROM embobinado WHERE schedule ='s750000'");
  21. $qyes=mysql_query ("SELECT * FROM corecoil WHERE schedule ='s750000'");
  22.  
  23. ?>
  24. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  25. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  26. <html xmlns="http://www.w3.org/1999/xhtml">
  27. <body><!-Vamos a crear una tabla que será impresa en el archivo excel->
  28.  
  29. <!-creamos la tabla de el reporte con border 1 y los títulos->
  30. <table width="641" border="1">
  31. <tr>
  32.  
  33. <th width="50%" style="background-color:#006; text-align:center; color:#FFF"><strong>suffix</strong></th>
  34. <th width="50%" style="background-color:#006; text-align:center; color:#FFF"><strong>Serie</strong></th>
  35. <th width="50%" style="background-color:#006; text-align:center; color:#FFF"><strong>Id TX</strong></th>
  36. <th width="50%" style="background-color:#006; text-align:center; color:#FFF"><strong>Linea</strong></th>
  37. <th width="50%" style="background-color:#006; text-align:center; color:#FFF"><strong>Area</strong></th>
  38. <th width="50%" style="background-color:#006; text-align:center; color:#FFF"><strong>KVA'S</strong></th>
  39. <th width="50%" style="background-color:#006; text-align:center; color:#FFF"><strong>Numero de reloj del operador</strong></th>
  40. <th width="50%" style="background-color:#006; text-align:center; color:#FFF"><strong>Numero de reloj del reparador</strong></th>
  41. <th width="50%" style="background-color:#006; text-align:center; color:#FFF"><strong>Falla</strong></th>
  42. <th width="50%" style="background-color:#006; text-align:center; color:#FFF"><strong>Codigo</strong></th>
  43. <th width="50%" style="background-color:#006; text-align:center; color:#FFF"><strong>Fase</strong></th>
  44. <th width="50%" style="background-color:#006; text-align:center; color:#FFF"><strong>Fecha entrada</strong></th>
  45. <th width="50%" style="background-color:#006; text-align:center; color:#FFF"><strong>Comentarios entrada</strong></th>
  46. <th width="50%" style="background-color:#006; text-align:center; color:#FFF"><strong>Estatus</strong></th>
  47. <th width="50%" style="background-color:#006; text-align:center; color:#FFF"><strong>Fecha salida</strong></th>
  48. <th width="50%" style="background-color:#006; text-align:center; color:#FFF"><strong>Comentarios salida</strong></th>
  49. <th width="50%" style="background-color:#006; text-align:center; color:#FFF"><strong>Comentarios </strong></th>
  50. </tr>
  51. <?php
  52. // Un proceso repetitivo para imprimir cada uno de los registros.
  53.  
  54. while($row = mysql_fetch_array($query))
  55. while($raw = mysql_fetch_array($qye))
  56. while($rew = mysql_fetch_array($qyes)){
  57. echo
  58. "<tr>
  59. <td bgcolor=\"#ededed\" align=\"center\">$row[suffix]</td>
  60. <td bgcolor=\"#ededed\" align=\"center\">$row[order]</td>
  61. <td bgcolor=\"#ededed\" align=\"center\">$row[item]</td>
  62. <td bgcolor=\"#ededed\" align=\"center\">$row[co]</td>
  63. <td bgcolor=\"#ededed\" align=\"center\">$row[responsible]</td>
  64. <td bgcolor=\"#ededed\" align=\"center\">$raw[statusemb]</td>
  65. <td bgcolor=\"#ededed\" align=\"center\">$raw[fechaemb]</td>
  66. <td bgcolor=\"#ededed\" align=\"center\">$rew[statuscore]</td>
  67. <td bgcolor=\"#ededed\" align=\"center\">$rew[fechacore]<td>
  68.  
  69. </tr>";
  70. }
  71. ?>
  72. </table>
  73. </table>
  74. </body>
  75. </html>