Buna , Ajutor export excell

Ai o întrebare legată de PHP? Incercăm să îi găsim soluţie. Sau poate doar vrei să publici un cod interesant.

Moderatori: Zamolxe, Moderatori

all3ss1o
Junior Member
Mesaje: 30
Membru din: Sâm Sep 25, 2010 12:48 pm
Localitate: Oradea
Contact:

Buna , Ajutor export excell

Mesajde all3ss1o » Dum Mai 27, 2012 8:49 am

Asi dori un mic ajutor am descarcat de pe net un script care genereaza un file excell cu date stabilite . Acum eu asi vrea sa le generez din baza de date in excell .Uitati ce am facut pana acuma dar nu gasesc rezolvarea :

<?php session_start();

#### Roshan's very simple code to export data to excel
#### Copyright reserved to Roshan Bhattarai - nepaliboy007@yahoo.com
#### if you have any problem contact me at http://roshanbh.com.np
#### fell free to visit my blog http://php-ajax-guru.blogspot.com

require_once('../config.php');

$cerereSQL = 'SELECT * FROM `intrari`';
$rezultat = mysql_query($cerereSQL);
while($rand = mysql_fetch_array($rezultat))
{

}

//first of all unset these variables
unset($_SESSION['report_header']);
unset($_SESSION['report_values']);
//note that the header contain the three columns and its a array
$_SESSION['report_header']=array("Destinatie","prenume","varsta");

// now the excel data field should be two dimentational array with three column
for($i=0;$i<=4;$i++) //loop through the needed cycle
{
echo $_SESSION['report_values'][$i][0]="'destinatie'"." ";
echo $_SESSION['report_values'][$i][1]="michael@yahoo.com"." ";
echo $_SESSION['report_values'][$i][2]="Nepal"." ";
echo "<br>";
}

?>
<a href="export_report.php?fn=order_report">Click here to generate report</a>
<!--the export_report.php takes one variable called fn as GET parameter which is name of the file to be generated, if you pass member_report as a value, then the name of the generated file would be member_report.php
-->


Multumesc anticipat si astept un raspuns!O zi frumoasa !



dechim
Senior Member
Mesaje: 1486
Membru din: Mar Mai 10, 2005 11:53 pm
Localitate: Drobeta Turnu Severin

Mesajde dechim » Dum Mai 27, 2012 12:41 pm



Înapoi la “Cod PHP”

Cine este conectat

Utilizatori ce ce navighează pe acest forum: Niciun utilizator înregistrat și 3 vizitatori