<?php
header(
"Content-Type: application/vnd.ms-excel"
);
header(
"Expires: 0"
);
header(
"Cache-Control: must-revalidate, post-check=0, pre-check=0"
);
header(
"content-disposition: attachment;filename=Reportes.xls"
);
?>
<HTML LANG=
"es"
>
<TITLE> Exportacion de Datos </TITLE>
</head>
<body>
<?php
$NombreBD
=
"Tu_DB"
;
$Servidor
=
"localhost"
;
$Usuario
=
"root"
;
$Password
=
""
;
$IdConexion
= mysql_connect(
$Servidor
,
$Usuario
,
$Password
);
mysql_select_db(
$NombreBD
,
$IdConexion
);
$sql
=
"SELECT Apellido, Nombre, Dni, Domicilio FROM Excel"
;
$result
=mysql_query(
$sql
,
$IdConexion
);
?>
<TABLE BORDER=
1
align=
"center"
CELLPADDING=
1
CELLSPACING=
1
>
<TR>
<TD>Apellido</TD>
<TD>Nombre</TD>
<TD>Dni</TD>
<TD>Domicilio</TD>
</TR>
<?php
while
(
$row
= mysql_fetch_array(
$result
)) {
printf('< tr>
< td> %s < /td>
< td> %s < /td>
< td> %s < /td>
< td> %s < /td>
< /tr>',
$row
[
"Apellido"
],
$row
[
"Nombre"
],
$row
[
"Dni"
],
$row
[
"Domicilio"
]);
}
mysql_free_result(
$result
);
mysql_close(
$IdConexion
);
?>
</table>
</body>
</html>
0 comentarios:
Publicar un comentario