resulta que estoy teniendo un problemita con php siempre, SIEMPRE que envio headers, tengo por ejemplo el siguiente codigo con el que se supone podria generar un archivo en excell.
Código:
y me genera los siguientes errores:<?php require_once('Connections/Myconection.php'); ?> <?php session_start(); ?> <html > <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Documento sin título</title> </head> <body> <?php mysql_select_db($database_Myconection, $Myconection); $sql = "SELECT clientes.nombre, preguntas.indicador, preguntas.tipo, preguntas.ask, puntaje.observaciones, puntaje.suma, puntaje.puntos FROM clientes, preguntas, puntaje WHERE puntaje.cliente=clientes.nit AND puntaje.pregunta=preguntas.id_pr AND preguntas.iden=19"; $r = mysql_query($sql) or trigger_error(mysql_error($Myconection),E_USER_ERROR); $return = ''; if( mysql_num_rows($r)>0){ $return .= '<table border=1>'; $cols = 0; while($rs = mysql_fetch_row($r)){ $return .= '<tr>'; if($cols==0){ $cols = sizeof($rs); $cols_names = array(); for($i=0; $i<$cols; $i++){ $col_name = mysql_field_name($r,$i); $return .= '<th>'.htmlspecialchars($col_name).'</th>'; $cols_names[$i] = $col_name; } $return .= '</tr><tr>'; } for($i=0; $i<$cols; $i++){ if($cols_names[$i] == 'fechaAlta'){ #Fromateo el registro en formato Timestamp $return .= '<td>'.htmlspecialchars(date('d/m/Y H:i:s',$rs[$i])).'</td>'; }else if($cols_names[$i] == 'activo'){ #Estado lógico del registro, en vez de 1 o 0 le muestro Si o No. $return .= '<td>'.htmlspecialchars( $rs[$i]==1? 'SI':'NO' ).'</td>'; }else{ $return .= '<td>'.htmlspecialchars($rs[$i]).'</td>'; } } $return .= '</tr>'; } $return .= '</table>'; mysql_free_result($r); } header("Content-type: application/vnd-ms-excel; charset=iso-8859-1"); header("Content-Disposition: attachment; filename=NombreDelExcel_".date('d-m-Y').".xls"); echo $return;?> </body> </html>
Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\Esatic\prueba.php:10) in C:\AppServ\www\Esatic\prueba.php on line 45
Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\Esatic\prueba.php:10) in C:\AppServ\www\Esatic\prueba.php on line 46
Ya he visto en otros post y en otros foros, y dicen que pueden ser espacios en blanco pero aca no los tengo y las directivas de errores en php las tengo todas en off, y tampoco imprimo nada en pantalla antes de enviar los headers entonces que podria ser ??? alguna idea espero que puedan ayudarme que ya estoy bastante fastidiado
![Neurótico](http://static.forosdelweb.com/fdwtheme/images/smilies/scared.png)