File: /home/asjudine/public_html/exportar_mindefensa.php
<?php
if(isset($_POST["exp"]))
{
require_once("excel.php");
require_once("excel-ext.php");
require_once("mainfile.php");
include ("config.php");
global $dbi;
$sql = "SELECT codigo, nombre, grado, cod_desc, libranza, fecha_libranza, valor_descuento, cuotas, pagaduria, mes_inicio, aņo_inicio, mes_termino, aņo_termino, proveedor FROM reporte_mindefensa WHERE proveedor = 'SERVIASJUDINET'";
$control = mysql_query($sql, $dbi) or die(mysql_error());
$totEmp = mysql_num_rows($control);
while($datatmp = mysql_fetch_assoc($control)) {
$data[] = $datatmp;
}
createExcel("excel-mysql.xls", $data);
exit;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Documento sin título</title>
</head>
<body>
<form id="form1" name="form1" method="post" action="">
<label>
<div align="center">
<input name="exp" type="submit" id="exp" value="exportar" />
</div>
</label>
</form>
</body>
</html>