Ver Mensaje Individual
  #1 (permalink)  
Antiguo 10/02/2011, 22:44
rpichinu
 
Fecha de Ingreso: noviembre-2010
Mensajes: 208
Antigüedad: 13 años, 5 meses
Puntos: 3
exportar a excel listado de registros con php

Que tal amigos tengo..el siguiente script me genera un listado de registro en una tabla html, estos registros los obtengo desde mysql.....kisiera que al final estuviera la opcion de exportar a EXCEL dicho listado...

aka va el codigo...

listar_prod.php:




<?php

include("conectar.php");

$rst_productos=mysql_query("SELECT *FROM productos ORDER BY nombre_prod");
$num_registros=mysql_num_rows($rst_productos);

if($num_registros=0)
{
echo " No existen registros";
exit(); //no ahy registros en la base de datos
}

$registros=10; //el numero de registro que se mostrara en pantalla en este 5 por cada pagina
@$pagina=$_GET['num']; // se recibe desde la url




?>



<head>
<title>Listar Productos</title>
<style type="text/css">
<!--
.Estilo7 {color: #FFFFFF}
-->
</style>
</head>

<body>
<h3 align="center"> Listado Productos Einlab</h3>

<table align="center" width="525" border="0" bgcolor="#0066FF">
<tr>
<td width="79" bgcolor="#0099CC"><span class="Estilo7">Cod Prod</span></td>
<td width="237" bgcolor="#0099CC"><span class="Estilo7">Nombre Producto</span></td>
<td width="87" bgcolor="#0099CC"><span class="Estilo7">Marca</span></td>
<td width="104" bgcolor="#0099CC"><span class="Estilo7">Modelo</span></td>
</tr>

<?php

while($fila=mysql_fetch_array($rst_productos))
{
?>
<tr>
<td width="79" bgcolor="#FFFFFF" ><?php echo $fila[0];?></td>
<td width="237" bgcolor="#FFFFFF" ><?php echo $fila["nombre_prod"];?></td>
<td width="87" bgcolor="#FFFFFF" ><?php echo $fila["marca_prod"];?></td>
<td width="104" bgcolor="#FFFFFF"><?php echo $fila["marca_prod"];?></td>
</tr>
<?php
}
?>
</table>


</div>
</body>
</html>