Ver Mensaje Individual
  #7 (permalink)  
Antiguo 23/11/2015, 13:37
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

este codigo lo utilizo en otra consulta y me funciona bien ahora quiero adecuarlo a este codigo

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,embobinado WHERE schedule='S750000'");
  20.  
  21. ?>
  22. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  23. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  24. <html xmlns="http://www.w3.org/1999/xhtml">
  25. <body><!-Vamos a crear una tabla que será impresa en el archivo excel->
  26.  
  27. <!-creamos la tabla de el reporte con border 1 y los títulos->
  28. <table width="641" border="1">
  29. <tr>
  30.  
  31. <th width="50%" style="background-color:#006; text-align:center; color:#FFF"><strong>Estilo</strong></th>
  32. <th width="50%" style="background-color:#006; text-align:center; color:#FFF"><strong>Serie</strong></th>
  33. <th width="50%" style="background-color:#006; text-align:center; color:#FFF"><strong>Id TX</strong></th>
  34. <th width="50%" style="background-color:#006; text-align:center; color:#FFF"><strong>Linea</strong></th>
  35. <th width="50%" style="background-color:#006; text-align:center; color:#FFF"><strong>Area</strong></th>
  36. <th width="50%" style="background-color:#006; text-align:center; color:#FFF"><strong>KVA'S</strong></th>
  37. <th width="50%" style="background-color:#006; text-align:center; color:#FFF"><strong>Numero de reloj del operador</strong></th>
  38. <th width="50%" style="background-color:#006; text-align:center; color:#FFF"><strong>Numero de reloj del reparador</strong></th>
  39. <th width="50%" style="background-color:#006; text-align:center; color:#FFF"><strong>Falla</strong></th>
  40. <th width="50%" style="background-color:#006; text-align:center; color:#FFF"><strong>Codigo</strong></th>
  41. <th width="50%" style="background-color:#006; text-align:center; color:#FFF"><strong>Fase</strong></th>
  42. <th width="50%" style="background-color:#006; text-align:center; color:#FFF"><strong>Fecha entrada</strong></th>
  43. <th width="50%" style="background-color:#006; text-align:center; color:#FFF"><strong>Comentarios entrada</strong></th>
  44. <th width="50%" style="background-color:#006; text-align:center; color:#FFF"><strong>Estatus</strong></th>
  45. <th width="50%" style="background-color:#006; text-align:center; color:#FFF"><strong>Fecha salida</strong></th>
  46. <th width="50%" style="background-color:#006; text-align:center; color:#FFF"><strong>Comentarios salida</strong></th>
  47. <th width="50%" style="background-color:#006; text-align:center; color:#FFF"><strong>Comentarios </strong></th>
  48. </tr>
  49. <?php
  50. // Un proceso repetitivo para imprimir cada uno de los registros.
  51. while($row = mysql_fetch_array($query)){
  52. echo
  53. "<tr>
  54. <td bgcolor=\"#ededed\" align=\"center\">$row[suffix]</td>
  55. <td bgcolor=\"#ededed\" align=\"center\">$row[order]</td>
  56. <td bgcolor=\"#ededed\" align=\"center\">$row[item]</td>
  57. <td bgcolor=\"#ededed\" align=\"center\">$row[co]</td>
  58. <td bgcolor=\"#ededed\" align=\"center\">$row[responsible]</td>
  59. <td bgcolor=\"#ededed\" align=\"center\">$row[statusemb]</td>
  60. <td bgcolor=\"#ededed\" align=\"center\">$row[fechaemb]<td>
  61.  
  62. </tr>";
  63. }
  64. ?>
  65. </table>
  66. </table>
  67. </body>
  68. </html>