New question

Question:

 
  -1  
 
Date: 25-06-2018 08:51:50 (In Spanish)

No me funciona la descarga del archio XLS[Unresolved]

Hola alguien sabe porque cuando mando a descargar no me arroja errores pero no descarga nada

html:
<!DOCTYPE html>
<html>
<head>
	<title></title>
</head>
<body>
	<form method="post" action="expo.php">
           <input type="submit" metod="export" class="btn btn-success" value="export">
        </form>
</body>
</html>

php:

$con = oci_connect("hr", "hr","localhost/xe");
$output = '';
if(isset($_POST["export_excel"]))
{
	$sql = "select * from departments";
	$resultado = oci_parse($con, $sql);
	if(oci_num_rows($resultado) > 0)
	{
		$output .='
		        <table class="table" bordered="1">
		           <tr>
		               <th>departments_id</th>
		               <th>departments_name</th>
		               <th>manager_id</th>
		            </tr> 
		            ';
		            while ($row = oci_fetch_array($resultado)) {
		            	$output .='

		                <tr>
		                  <th>'.$row ["departments_id"].'</th>
		                  <th>'.$row ["departments_name"].'</th>
		                  <th>'.$row ["manager_id"].'</th>
		                </tr> 
		                ';
		            }
		            $output .='</table>';
		            header("content-Type:application/xls");
		            header("Content-Disposition: attachment;filename=download.xls");
                            echo $output;
	}
}
?>
Tags: Download Files - Excel - PHP - Question Votes: -1 - Answers: 1 - Views: 9 Share on: Google Facebook Twitter LinkedIn Link
 

Answers:

  • Date: 26-06-2018 06:42:58 Amigos será que pueden utilizar las etiquetas de codigo que estan en el editor, es más fácil interpretar el código, para ello estan:

    $con = oci_connect("hr", "hr","localhost/xe");
    $output = '';
    if(isset($_POST["export_excel"]))
    {
    $sql = "select * from departments";
    $resultado = oci_parse($con, $sql);
    if(oci_num_rows($resultado) > 0)
    {
    $output .='
    <table class="table" bordered="1">
    <tr>
    <th>departments_id</th>
    <th>departments_name</th>
    <th>manager_id</th>
    </tr> 
    ';
    while ($row = oci_fetch_array($resultado)) {
    $output .='
    
    <tr>
    <th>'.$row ["departments_id"].'</th>
    <th>'.$row ["departments_name"].'</th>
    <th>'.$row ["manager_id"].'</th>
    </tr> 
    ';
    }
    $output .='</table>';
    header("content-Type:application/xls");
    header("Content-Disposition: attachment;filename=download.xls");
    echo $output;
    }
    }
    ?>
    


    se ve distinto no?
      Votes: 2 - Link answer
     
To actively participate in the community first must authenticate, enter the system.Sign In