Re: Print MySQL DB as Exel File?

From: Date: Wed, 14 Mar 2001 22:21:26 +0000
Subject: Re: Print MySQL DB as Exel File?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-43959@lists.php.net to get a copy of this message
Hello, The header will make netscape offer you a download of the file, and IE will open it in a excell format. For the display, just put your result in a nice html table and excell will convert it, it's quite simple. print "<table>"; print "<th>Event</th>"; ... print all your header here while ($row = mysql_fetch_array($result)) { print "<tr>\n"; print "<td>". $row['Event'] ."</td>\n"; and so on... } </table> hope it help, py ----- Original Message ----- From: Jason Murray <Jason.Murray@melbourneit.com.au> To: <jeff@webdesigns1.com>; PHP <php-general@lists.php.net> Sent: Thursday, March 15, 2001 2:28 AM Subject: RE: [PHP] Print MySQL DB as Exel File? > > Could anyone help me out with how to print the entire contents of a > > database as an Excel file? I'm familiar with the header: > > > > header("Content-Type: application/vnd.ms-excel"); > > > > just not sure how to go about it beyond that. I have this code and > > am not sure what do do after it. Thanks. > > Excel spreadsheets are in a proprietary format as far as I know. > > However, if you output the database one line = one row, and tab delimit > the lines, Excel will notice you're importing a text file and give you > some appropriate options (select delimiter, etc). > > I'd go for tab delimiting over comma delimiting, since your text fields > will probably contain commas but will *very* *exceedingly* rarely have > tabs. > > I've ripped some code out of phpMyAdmin to do this (ta Tobias, if you're > watching ;)) - I can post it if you want to. > > Jason > > -- > Jason Murray > jasonm@melbourneit.com.au > Web Design Team, Melbourne IT > Fetch the comfy chair! > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#43959) next »