/ Published in: PHP
Modify includes to connect and select to provide correct result set
Expand |
Embed | Plain Text
<?php include 'config.php'; include 'opendb.php'; $select = "SELECT * from table_name"; for ( $i = 0; $i < $fields; $i++ ) { } { $line = ''; foreach( $row as $value ) { { $value = "\t"; } else { $value = '"' . $value . '"' . "\t"; } $line .= $value; } } if ( $data == "" ) { $data = "\n(0) Records Found!\n"; } print "$header\n$data"; ?>
Comments
Subscribe to comments
You need to login to post a comment.

Hello, thanks for posting this, helped me out a lot. I just had to make two small changes in your script to run smooth in my environment (tested in WAMP on WinXP and MS Office 2003): 1. just after the includes I initialized the $header and the $data variables like $header = "" and $data = "" 2. on line 23 I had to put an empty space before the \t to force Excel leave the cell empty. so the value looks like this " \t"
Thanks again and good luck, Cheers