Also, excel can read html tables.  Create the html table and push it to the
user as filename.xls ...

coz.


On 9/8/06, Bocean Marius <[EMAIL PROTECTED]> wrote:
>
>    yes!
> read this part of the code:
>
> $export = mysql_query("SELECT * FROM your_table");
> $count = mysql_num_fields($export);
> for ($i = 0; $i < $count; $i++) {
> $header .= strtoupper(mysql_field_name($export, $i))."\t";
> }
> while($row = mysql_fetch_row($export)) {
> $line = '';
> foreach($row as $value) {
> if ((!isset($value)) OR ($value == "")) {
> $value = "\t";
> } else {
> $value = str_replace('"', '""', $value);
> $value = '"' . $value . '"' . "\t";
> }
> $line .= $value;
> }
> $data .= trim($line)."\n";
> }
> $data = str_replace("\r", "", $data);
> if ($data == "") {
> $data = "\n(0) Records Found!\n";
> }
>
> header("Content-type: application/octet-stream");
> header("Content-Disposition: attachment; filename=yourfile.xls");
> header("Pragma: no-cache");
> header("Expires: 0");
> print "$header\n$data";
>
>
> ----- Original Message -----
> From: egacatorce
> To: [email protected] <php_mysql%40yahoogroups.com>
> Sent: Friday, September 08, 2006 1:40 PM
> Subject: [php_mysql] Writing Data To Excel File
>
> Guys,
>
> I haven't done this yet. How can I write data from MySQL database to
> MS Excel file using PHP? Thanks!
>
> [Non-text portions of this message have been removed]
>
> 
>


[Non-text portions of this message have been removed]



The php_mysql group is dedicated to learn more about the PHP/MySQL web database 
possibilities through group learning.  
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php_mysql/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/php_mysql/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to