Print out contents of to Excel


Posted on 16th Feb 2014 07:03 pm by admin

I have got this script that gathers all the data that I need but I need it to send it to excel instead back to the screen in the web browser. How can I do this? Should I use something like:

$csv_output .= "n";

Here is my code:

// Make a MySQL Connection
// Construct our join query
$query = "SELECT sunocoimport.duns_num, custmast.gl_num, custmast.division_num, custmast.customer_num, sunocoimport.summary_date, sunocoimport.cc_fees, custmast.fee_percent, custmast.clear FROM sunocoimport, custmast WHERE sunocoimport.duns_num = custmast.duns_num AND (sunocoimport.cc_fees * custmast.fee_percent / 100) <> 0";

$result = mysql_query($query)or die(mysql_error());

// Print out the contents of each row into a table
while($row = mysql_fetch_array($result)){
echo $row['division_num'].",".$row['customer_num'].",".$row['summary_date'].",".round($row['cc_fees'] * $row['fee_percent'] /100 , 2) .",".$row['clear'].",".$row['gl_num'];
echo "<br />";
}
?>

Thanks for your help!

No comments posted yet

Your Answer:

Login to answer
84 Like 12 Dislike
Previous forums Next forums
Other forums

Printer configuration
Hi All,
Suppose one of the user deleted the printer settings unfortunatly ,then what is the pro

upload only text files
hi guys i want to upload only text like like (pdf,note pad and ofiice files) so can any one please t

Keeping data in form
How can I keep whatever I write in the form?

Adding meta tags under Zend FW
Hello there, recently has come to my hands the FTP of a website which is running under Zend, I would

Security Exception on pages using AJAX
I am getting the exception: attempted to perform an operation not allowed by the security policy on

FTP issues
Hi all,


I am currently facing some serious problems with a script and really need some ad

Pulling out some result data from MYSQL
Hey Guys,

I've built a PHP page that has a for just imagine something like registration form

How to add advertisment on top of videos
Hello,
I was told that i should find the answer for this problem in this forums.
I searched a

mysql select with $_get ?
Hi, i have this code:
Code: // If char id is 0 and character dont exist do:
if ($_GET["id

array & querys help/advice.
Ok so here goes , I have a mysql database and basically here's what I need to do.

// foreach

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash