How to export a table on my page in excell format or pdf

Discussion in 'PHP' started by adsegzy, Apr 14, 2011.

  1. #1
    Hello gurus,
    Am having a page on my site where each members can view their transactions. i echoed the transaction out in a table. i want to create a button whereby on clicking this button the page/table will be exported in microsoft excell format or pdf format, is this possible?
     
    adsegzy, Apr 14, 2011 IP
  2. Sepehr

    Sepehr Peon

    Messages:
    568
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Sepehr, Apr 14, 2011 IP
  3. nklven

    nklven Peon

    Messages:
    8
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    You can use this one. I had exported username and password

    $result = mysql_query($query) or die("Error: ". mysql_error(). " with query ". $query);
    while($myrow = mysql_fetch_array($result)) {
    $XML.= $myrow['username']. ",";
    $XML.= $myrow['password']. ",\n";
    }

    echo $XML;
     
    nklven, Apr 14, 2011 IP
  4. Sepehr

    Sepehr Peon

    Messages:
    568
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #4
    well that's not exactly an excel file but that can be used to make a .csv file which can be opened with excel. however you'll need to write the $XML variable to a .csv file instead of printing it out.
     
    Sepehr, Apr 14, 2011 IP