Det burde ikke være noget problem at omskrive den her stump php til noget
andet :)
Det koster en bajer...
Ta den:
-------------------------START------------------------
<?php
header( "Content-type: binary/octet-stream");
header( "Content-Disposition: atachment;
filename=outputfil_fra_kundedatabase.xls_");
include("databaseconnect.inc.php"); // Opretter forbindelse til mysql.
$skrivtilfil_tal = 10000;
// Excel begin of file header
function xlsBOF() {
echo pack("ssssss", 0x809, 0x8, 0x0, 0x10, 0x0, 0x0);
return;
}
// Excel end of file footer
function xlsEOF() {
echo pack("ss", 0x0A, 0x00);
return;
}
// Function to write a Number (double) into Row, Col
function xlsWriteNumber($Row, $Col, $Value) {
echo pack("sssss", 0x203, 14, $Row, $Col, 0x0);
echo pack("d", $Value);
return;
}
// Function to write a label (text) into Row, Col
function xlsWriteLabel($Row, $Col, $Value ) {
$L = strlen($Value);
echo pack("ssssss", 0x204, 8 + $L, $Row, $Col, 0x0, $L);
echo $Value;
return;
}
xlsBOF(); // begin Excel stream
xlsWriteLabel(0,0,"Kundenummer");
xlsWriteLabel(0,1,"Firmanavn");
xlsWriteLabel(0,2,"Fornavn");
$nr=1;
while ($skrivtilfil_tal <=15000){
$result = mysql_query("select * from $kunde_database where kunde_nr =
'${"".$skrivtilfil_tal}'");
$row = mysql_fetch_array($result);
if ($row[kunde_nr]) {
xlsWriteNumber($nr,0,"$row[kunde_nr]");
xlsWriteLabel($nr,1,"$row[firmanavn]");
xlsWriteLabel($nr,2,"$row[fornavn]");
$nr=$nr+1;
}
$skrivtilfil_tal = $skrivtilfil_tal+1;
}
xlsEOF(); // close the stream
?>
-------------------------SLUT------------------------
|