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

noob question
i traying to do a php form with auto replay for both(me and the user who send me a mail),

a u

FTP issues
Hi all,


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

This is driving me nuts!
This insert query looks to be alright, however I get this error:

QuoteYou have an error in yo

DataTable Help Required
Hi all I am creating an app that utilises and MS Access back end and queries it quite a bit at vario

Connect to database that isn't localhost
I am currently doing a small script for a company that doesn't have mySql support on there hosting.

Multithreading in Oracle (Java, SQLJ, Pro*C,??) on 10g
I am investigating how to run a Java stored procedure in multithread mode.
I know that if I chang

php code to accept and delete incoming data
Using following HTML Code please show me how to write PHP code to accept and delete the incoming dat

i want run some web server under the ip sharer
hello i want run some web server under the ip sharer
my ip is floating ip but it doesnt matter

Empty text file when there is over XXXX lines of text.

define("RANDOM_FILE","/public_html/random.txt");
$randomEntry = "

update 2 columns by doing inner 2-column query
Hi,
is something like this possible?

update contract_all set col1,col2 =
(

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