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

asp authentication problem
Hello all, I want to use the asp authentication (from asp.net configuration) in my web site. there

Adding post count
How would I make it so everytime someone clicks submit on my form, their row in the database for the

Alternate messaging
I have 4 strings in MySQL db1

$string1 : Hello
$string2 : Hi
$string3 : Great
$strin

cURL and Sessions
Ohai.

So, I'm trying to cURL a bunch of things off of a page, and put them into a session. I'

validating url
im trying to validate url's sent to me by a form
the url's im collecting are for placing banners

How to schedule the a job?
Hi,
I have prepared a task ( i.e. a procedure is prepare the file and send the same to con

help with image text
Hi ...

see i need the text of the name and number to start in the center and always be in the

Multi Level Array Problem
hi all,

For example I have array like below:

$temp = array(array('north america', 'us'

php multiple action on submit
I have a form which says:

<form enctype='multipart/form-data' method='post' action='pr

wav to mp3 + goDaddy
I need to convert wav files to mp3s. From what I have found so far one way to do it is to have my PH

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