How do I program in php to interact with my sql database to export the data to a new excel spreadsheet?

I have the MySql Database as well as we am seeking for the great easy to assimilate book in php which will correlate with my Database as well as lift the report to the brand new Microsoft Excel file.

Please insert any great links we know of. Thanks!

One thought on “How do I program in php to interact with my sql database to export the data to a new excel spreadsheet?

  1. Excel can read CSV files; these are very easy to write in PHP:

    $file_handle = fopen("filename.csv", "w");

    $result = mysql_query("SELECT a,b,c FROM table");
    while( $row = mysql_fetch_assoc($result) )
    {
    fwrite($file_handle, $row['a'] . ";" . $row['b'] . ";" . $row['c'] . ";\n");
    }
    mysql_free_result($result);

    fclose($file_handle);

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>