Buenas esoty haciendo una proyecto para la uni y tengo una gran duda como recorro completamente la la tabla, para uqe me arroje en el excel todos los datos que les pido por esa fecha por ejemplo pongo 2013-01-22 y 2013-01-24, pero me sale solo el pŕimero que encuentra del 22 y no todos. Gracias
consultaEstadistica.php
Código PHP:
Ver original<form action="excel.php" id="form1" name="form1" method="post" >
<input name="opcion" id="opcion" type="hidden" />
<input name="status" id="status" type="hidden" value="<?php echo $_POST['status']; ?>"/>
<div id="content" style="width: 915px;">
<h1>Modulo de Generación de Estadística</h1>
<strong>Fecha de inicio:</strong>
<input type="text" name="fecha_inicio" id="fecha_inicio"
onClick="ShowCalendario(event)" size="10">
<strong>Fecha Fin:</strong>
<input ="text" name="fecha_fin" id="fecha_fin"
onClick="ShowCalendario(event)" size="10">
<p></p>
<p></p>
<input type="submit" name="Buscar"id="Buscar" value="Buscar" >
</div>
</form>
excel.php
Código PHP:
Ver original<?php
$fecha_inicio= $_REQUEST['fecha_inicio'];
$fecha_fin= $_REQUEST['fecha_fin'];
if ($fecha_inicio=='0000-00-00') {
//echo $fecha_inicio;
} else {
//echo $fecha_inicio;
}
if ($fecha_fin=='0000-00-00') {
//echo $fecha_fin;
} else {
//echo $fecha_fin;
}
include "../PHP/conexion.php";
$registros=mysql_query("select cod_dea, fecha_inicio, fecha_fin, entregas_2do, entregas_3ro, entregas_4to, entregas_5to, entregas_6to, total_entregas, direccion,
plantel, estado, municipio, director, tlf_director, lugar_entrega
from cronograma_temp where like fecha_inicio >= STR_TO_DATE('$fecha_inicio','%Y-%m-%d')
AND fecha_fin<= STR_TO_DATE('$fecha_fin','%Y-%m-%d')",$conexion) or
{
header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // Date in the past header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); header('Cache-Control: no-store, no-cache, must-revalidate'); // HTTP/1.1 header('Cache-Control: pre-check=0, post-check=0, max-age=0'); // HTTP/1.1 header('Content-Transfer-Encoding: none'); header('Content-Type: application/vnd.ms-excel'); // This should work for IE & Opera header('Content-type: application/x-msexcel'); // This should work for the rest header('Content-Disposition: attachment; filename="nombre.xls"');
echo $reg['cod_dea'];
echo $reg['fecha_inicio'];
echo $reg['fecha_fin'];
echo $reg['entregas_2do'];
echo $reg['entregas_3ro'];
}
else
{
echo "No existe eventos registrado con esas fechas.";
}
?>