Tendrias que meterlo dentro de un bucle for, foreach o while, pero debes cambiar un poco la estructura a algo como esto.
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
{
$echo .= $reg['cod_dea'];
$echo .= $reg['fecha_inicio'];
$echo .= $reg['fecha_fin'];
$echo .= $reg['entregas_2do'];
$echo .= $reg['entregas_3ro'];
}
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 $echo;
else
{
echo "No existe eventos registrado con esas fechas.";
}
?>
Aunque te recomendaria que uses una clase, hay muchas clases ya hechas para exportar a excel ...