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;
?>

Link to comment
Share on other sites

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.

Edited by Muddy_Funster
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.