Ver Mensaje Individual
  #1 (permalink)  
Antiguo 30/07/2009, 16:51
Avatar de jpogsistem
jpogsistem
 
Fecha de Ingreso: diciembre-2001
Mensajes: 2.405
Antigüedad: 22 años, 4 meses
Puntos: 4
Headers - Descargable de Excel --Me Funciona en un Server y en otro No

Que tal Masters,

Resulta que tengo este codigo que me funciona perfecto con Internet Explorer 7 en un server. Pero resulta que he migrado a otro server (Mismo plan de hosting en la misma empresa, etc...).

Código PHP:
<?php require("access_level.inc.php"); ?>
<?php 
require_once('../Connections/conexion.php'); ?>
<?php
mysql_select_db
($database_sistema$sistema);
#Sql, acá pone tu consulta a la tabla que necesites exportar filtrando los datos que creas necesarios.
$sql "SELECT nombre as NOMBRE_RAZON_SOCIAL, tipo as TIPO, nit as NIT, direccion as DIRECCION, ciudad as CIUDAD, telefono as TELEFONO FROM afianzados WHERE nombre LIKE '$nombre' AND ciudad LIKE '$ciudad' AND nit LIKE '$nit' ORDER BY id_afianzado DESC";
$r mysql_query$sql ) or trigger_errormysql_error($subaru), 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++){
            
#En esta iteración podes manejar de manera personalizada datos, por ejemplo:
            
if($cols_names[$i] == 'Due_By_Provider' OR  $cols_names[$i] == 'Due_By_subaru' OR  $cols_names[$i] == 'Possible_Extra_Fees'  OR  $cols_names[$i] == 'Projected_Billing_Fees' OR  $cols_names[$i] == 'Projected_Repricing_Fees' OR  $cols_names[$i] == 'Projected_Management_Fees' OR  $cols_names[$i] == 'Total_Projected_Fees' OR  $cols_names[$i] == 'Total_Recovery' OR  $cols_names[$i] == 'Total_Collected' OR  $cols_names[$i] == 'Balance' OR  $cols_names[$i] == 'Extra_Fees' OR  $cols_names[$i] == 'Realized_Billing_Fees' OR  $cols_names[$i] == 'Realized_Repricing_Fees' OR  $cols_names[$i] == 'Realized_Management_Fees' OR  $cols_names[$i] == 'Total_Realized_Fees' OR  $cols_names[$i] == 'subaru_Fees_Balance' OR  $cols_names[$i] == 'Currency_Commission' OR  $cols_names[$i] == 'Total_Operating_Expenses' OR  $cols_names[$i] == 'Total_Extraordinary_Expenses' OR  $cols_names[$i] == 'Net_For_subaru')
            { 
            
$return .= '<td>'number_format($rs[$i],2,",",".").'</td>';  
            }
            elseif(  (
$cols_names[$i] == 'Algo') && ($rs[$i] <= 0)  )
            { 
            
$return .= '<td>'number_format(0,2,",",".") .'</td>';
            }
            else
            {
            
$return .= '<td>'.htmlspecialchars($rs[$i]).'</td>';
            }
        }
        
$return .= '</tr>';
    }
    
$return .= '</table>';
    
mysql_free_result($r);
}
#Cambiando el content-type más las <table> se pueden exportar formatos como csv
header("Content-type: application/vnd-ms-excel; charset=iso-8859-1");
header("Content-Disposition: attachment; filename=Reporte_Afianzados_".date('m-d-Y').".xls");
header("Pragma: cache");
header("Expires: 0");
echo 
$return;  
?>
Pero en el nuevo server no me funciona y me saca este error :



Puede ser alguna Directiva del php.ini ? Como creen que puedo corregirlo ?

Muchas Gracias. Saludos.
__________________
EL LIMITE ES EL UNIVERSO