Results 1 to 4 of 4

Thread: header setting

  1. #1
    Junior Member
    Join Date
    Sep 2008
    Answers
    1

    header setting

    hi every body.
    I want to download an excel file in php.it has 3 sheet with some row and col.
    I use this code to do it:

    header('Pragma: public');
    header('Cache-Control: no-store, no-cache, must-revalidate'); header('Cache-Control: pre-check=0, post-check=0, max-age=0');
    header ("Pragma: no-cache");
    header("Expires: 0");
    header('Content-Transfer-Encoding: none');
    header("Content-type: application/x-msexcel");
    header("Content-disposition: attachment; filename=MapFeaturesExcel.xls");
    readfile("$Folder / $export_file");
    exit(0);

    but after I look MapFeaturesExcel.xls I see only one sheet,and all of data show in one cell.it is very different from the source file.where is my wrong?


  2. #2
    Junior Member
    Join Date
    Aug 2007
    Answers
    7

    Re: header setting

    What you want??
    1) copy data form excel file to database
    2) database to excel file


  3. #3
    Junior Member
    Join Date
    Oct 2008
    Answers
    2

    Thumbs down Re: header setting

    i give code,which can export sql data to exel file(csv format)...

    $SQL="Select * from student";
    $tot=mysql_query($SQL,$rs);
    if($tot==0)
    {
    $msg="No records found with such roll number"."
    "."Please enter valid starting & ending roll no.!";
    export_show($msg);
    print "$data[roll_no]\"";
    die();
    }
    header("Content-type: text/html");
    header("Content-Disposition: attachment; filename=student_data.csv");
    print "NAME, AGE, SEX, COUNTRY, ABOUT, IMAGE_PATH, EMAIL, QUALIFICATION1, QUALIFICATION2, QUALIFICATION3, QUALIFICATION4, ROLL_NO, DATE_JOIN";
    while($data = mfa($rs))
    {
    $row="$data[name]";
    $row.=",\"$data[age]\"";
    $row.=",\"$data[sex]\"";
    $row.=",\"$data[country]\"";
    $row.=",\"$st[about]\"";
    $row.=",\"$data[image_path]\"";
    $row.=",\"$data[email]\"";
    $row.=",\"$data[qualification1]\"";
    $row.=",\"$data[qualification2]\"";
    $row.=",\"$data[qualification3]\"";
    $row.=",\"$data[qualification4]\"";
    $row.=",\"$data[roll_no]\"";
    $row.=",\"$data[date_join]\"";
    print $row."\n";
    }


  4. #4
    Junior Member
    Join Date
    Oct 2008
    Answers
    2

    Re: header setting

    header("Content-type: text/html");
    header("Content-Disposition: attachment; filename=filename.csv");


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact