Jump to content

having trouble drawing from db to excel file


fabiez

Recommended Posts

Hi, I can write in my .xls file but 'n6' doesn't return anything. Help please?

 

<?php
require "config.php";

$date = time();
$domain = date('Y_m', $date);
$datecase = date('m', $date);
$file = $domain . ".xls";

/*datum*/
switch ($datecase) {
case 1:
 $data = "Januari\n";
 break;
case 2:
 $data = "Februari\n";
 break;
case 3:
 $data = "Mars\n";
 break;
case 4:
 $data = "April\n";
 break;
case 5:
 $data = "Maj\n";
 break;
case 6:
 $data = "Juni\n";
 break;
case 7:
 $data = "Juli\n";
 break;
case 8:
 $data = "Augusti\n";
 break;
case 9:
 $data = "September\n";
 break;
case 10:
 $data = "Oktober\n";
 break;
case 11:
 $data = "November\n";
 break;
case 12:
 $data = "December\n";
 break;
}

$data .= "\n\tNärvaro\t\tAktivt deltagande\t\tKognitivt stöd\t\tSocial samvaro\t\tKommentar\n";
$data .= "1\t\t1\t\t1\t\t1\t\t1\n";

$Result = mysql_query("select n6 from cards where dte='01 2013'", $Link);
$Result = mysql_fetch_array($Result);
data .= "$Result[n6]\n";

$data .= "2\t\t2\t\t2\t\t2\t\t2\n";
$data .= "3\t\t3\t\t3\t\t3\t\t3\n";
$data .= "4\t\t4\t\t4\t\t4\t\t4\n";
$data .= "5\t\t5\t\t5\t\t5\t\t5\n";
$data .= "6\t\t6\t\t6\t\t6\t\t6\n";

header("Content-Type: application/ms-excel");
header("Content-Disposition: attachment; filename=" . $file);
header("Pragma: no-cache");
header("Expires: 0");
print $data;
?>

I was looking for information like the following sample I have taken from a table in my sandbox:

 

uid int(11) unsigned NO PRI auto_increment

headline varchar(254) NO MUL

article text YES

postTime timestamp YES MUL CURRENT_TIMESTAMP

expireDate date YES MUL

postStatus char(1) NO MUL 1

 

Edt . formating in this new forum really neads some work.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.