By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,304 Members | 1,242 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,304 IT Pros & Developers. It's quick & easy.

php code "export table to excel"

P: 22
Hello Guys,....!
Can you help me how to export my table to excell using php code ..?
thanks alot
Feb 13 '07 #1
Share this Question
Share on Google+
2 Replies

P: 17
You should use pear spread sheet
download pear spread sheet and use the below code
$Id: report_all.php,v 1.1 2004/08/30 16:03:40 chris Exp $
generate a spreadsheed from and addressbook in mysql database.

include "dblib.php";

require_once 'Spreadsheet/Excel/Writer.php';

$workbook = new Spreadsheet_Excel_Writer();
$format_bold =& $workbook->addFormat();

$worksheet =& $workbook->addWorksheet();
$worksheet->write(0, 0, "name", $format_bold);
$worksheet->write(0, 1, "address", $format_bold);
$worksheet->write(0, 2, "phone", $format_bold);
$worksheet->write(0, 3, "email", $format_bold);
$worksheet->write(0, 4, "comments", $format_bold);

# start by opening a query string
$fullquery="select * from smslog";


$worksheet->write($i, 0, "$row[name]");
$worksheet->write($i, 1, "$row[address]");
$worksheet->write($i, 2, "$row[phone]");
$worksheet->write($i, 3, "$row[email]");
$worksheet->write($i, 4, "$row[comments]");
I hope this will solve your problem
Feb 13 '07 #2

P: 22
thanks alot you're amazing.
Feb 13 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.