Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Extracting MySql table

Options
  • 18-12-2008 7:00pm
    #1
    Registered Users Posts: 3,875 ✭✭✭


    Hello I am designing a website that links a MySql database to dreamweaver.

    On Certain sites I display SQL tables in simple Dreamweaver tables

    as well as this I want to have a few buttons with the options to;

    print table
    save table as word file
    and save as excel file


    does anyone know how i could go about doing this?
    Would it involve interacting with the mysql table or the table I produce in dreamweaver,

    all help is much appreciated.


Comments

  • Closed Accounts Posts: 12,382 ✭✭✭✭AARRRGH


    :confused:

    If I understand correctly...

    1. You want to display the contents of a database table on a webpage.
    2. You will format the data using a normal html table.
    3. There will be three links - print, save page as word document, save page as excel spreadsheet?

    Am I correct?


  • Registered Users Posts: 3,875 ✭✭✭ShoulderChip


    yes exactly sorry for confusion.

    I have done steps 1 and 2,
    I am unsure how to do step 3.


  • Registered Users Posts: 2,793 ✭✭✭oeb


    For number 3 look at the PEAR Excel Writer for PHP. It's quite simple to use. There will also be equivilants floating around for word. For printing it, just open up a new window and keep most of the formatting (colours etc) out of it.


  • Registered Users Posts: 3,875 ✭✭✭ShoulderChip


    thank you,
    i have downloaded that, just to confirm does it work for windows?
    it is a serious of php files, when i try and open them in internet explorer it crashes, should i open them in dreamweaver?


  • Registered Users Posts: 2,793 ✭✭✭oeb


    thank you,
    i have downloaded that, just to confirm does it work for windows?
    it is a serious of php files, when i try and open them in internet explorer it crashes, should i open them in dreamweaver?


    PHP is a scripting language. They need to be executed on a web server with PHP installed. You can open them in dream weaver to edit them. If you have never used PHP before, it would be adviseable to read up on it a little first, using PEAR stuff is probably a little deep to be jumping in head first.


  • Advertisement
  • Registered Users Posts: 3,875 ✭✭✭ShoulderChip


    Ok I now some basics of php, but i usually use Dreamweave to do them for me,
    for eg i click insert recordset and it makes the php.
    if i upload those php files to my server is there a simple command i can set a button to open a table in the default excel way?


  • Registered Users Posts: 2,793 ✭✭✭oeb


    Ok I now some basics of php, but i usually use Dreamweave to do them for me,
    for eg i click insert recordset and it makes the php.
    if i upload those php files to my server is there a simple command i can set a button to open a table in the default excel way?

    It's a little different than that.

    There should be an example in there, but if I remember correctly, with PEAR excel writer you need to do the following.

    Start the writer class,
    Enter formatting classes for the rows,
    Define the rows,
    create headers,
    grab the db results,
    loop through them creating the rows as you go,
    define the doctype,
    output the content.


  • Registered Users Posts: 3,875 ✭✭✭ShoulderChip


    Ok I do not have a clue what is going on with this Pear prgram,

    is there really not a way to open up a table in excel,
    even if it just copied and pasted pretty much from the table (just once it realised the different rows and columns)

    should i be googling

    extract to excel from dreamweaver

    or

    extract to excel from html table

    extract to excel from table php

    i dont know how to find the answer??


  • Subscribers Posts: 9,716 ✭✭✭CuLT


    Maybe this?


  • Registered Users Posts: 3,875 ✭✭✭ShoulderChip


    CuLT wrote: »
    Maybe this?

    cheers that may come in handy at some point but I need to go one step further and to open it in excel automatically

    it is not for me but the end user of my project.


  • Advertisement
  • Registered Users Posts: 2,793 ✭✭✭oeb


    PEAR is the only way I have ever done it. And it works.

    The problem with excell is that it is a propriatry format. It is not that easy to work with on a development level. Because of this we need to rely on third party interfaces (Such as pears excell writer). You could write your own software to do this, but this would be very advanced.

    Something like excell writer does require a bit of complexity because it needs to be flexible. Give me a look at the code you are using to extract the data into a html table, and I will take a quick stab at showing you how you would use pear to fit it into an excell spreadsheet.


  • Subscribers Posts: 9,716 ✭✭✭CuLT


    Depending on how much of a hit you're willing to take on the "look" of the document, outputting as CSV might be handier. Tabular, opens in Excel, etc.


  • Registered Users Posts: 3,875 ✭✭✭ShoulderChip


    oeb wrote: »
    PEAR is the only way I have ever done it. And it works.

    The problem with excell is that it is a propriatry format. It is not that easy to work with on a development level. Because of this we need to rely on third party interfaces (Such as pears excell writer). You could write your own software to do this, but this would be very advanced.

    Something like excell writer does require a bit of complexity because it needs to be flexible. Give me a look at the code you are using to extract the data into a html table, and I will take a quick stab at showing you how you would use pear to fit it into an excell spreadsheet.


    Ok thanks I will pm it to you because the company I am doing it for would not want it public.



    Re cult,
    how do i output it into csv format?
    I tried just renaming my php file csv but that just outputed the code into excel, so it there someway to just send the resulting text of a webpage into csv?


  • Subscribers Posts: 9,716 ✭✭✭CuLT


    Yeah, it's relatively straight forward, try reading a few pages from these results.

    I think you should try buying a book on basic programming with PHP or another web programming language if you can't get anywhere with those results.

    Best of luck.


  • Registered Users Posts: 3,875 ✭✭✭ShoulderChip


    CuLT wrote: »
    Yeah, it's relatively straight forward, try reading a few pages from these results.

    I think you should try buying a book on basic programming with PHP or another web programming language if you can't get anywhere with those results.

    Best of luck.

    hiya cheers http://www.tutorial5.com/content/view/159/85/
    I finally got it working with the help of that site,

    i also managed after much error to get google maps interacting with the mysql,

    god I hate figuring out new things I will never use again.


Advertisement