Ver Mensaje Individual
  #1 (permalink)  
Antiguo 28/09/2011, 00:35
chumex
 
Fecha de Ingreso: septiembre-2011
Mensajes: 18
Antigüedad: 12 años, 7 meses
Puntos: 0
Problema con exportar a excel

Bueno en primer lugar saludos a todos.
tengo este es el codigo para enviar una a excel:

Código PHP:
<?php require_once('Connections/conexion_ongemprender.php'); ?>
<?php
header
('Content-type: application/vnd.ms-excel');
header("Content-Disposition: attachment; filename=bd_Curanilaue.xls");
header("Pragma: no-cache");
header("Expires: 0");
?>
<?php
$conexion_ongemprender 
mysql_connect("localhost""root""");
mysql_select_db("bd_ongemprender"$conexion_ongemprender);
$q "SELECT Correlativo, Region FROM bd_curanilahue";
$rs mysql_query($q$conexion_ongemprender);
$tot mysql_num_rows($rs);
?>

<table>
    <thead>
        <tr>
            <td>Correlativo</td>
            <td>Region</td>
          
        </tr>
    </thead>
    <tbody>

    <?php while($row mysql_fetch_assoc($tot)):?>

    <tr>
        <td><?php echo $row ['Correlativo'?></td>
        <td><?php echo $row ['Region'?></td>
        
    </tr>

    <?php endwhile;?>

    </tbody>
</table>
me abre el archivo excel pero vacio y con este error:
Warning: mysql_fetch_assoc() expects parameter 1 to be resource, null given in C:\wamp\www\bd_ongemprender\exportarCuranilahue.ph p on line 32

la linea 32 es la linea donde se encuentra el while