943,856 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Marked Solved
  • Views: 3099
  • PHP RSS
You are currently viewing page 1 of this multi-page discussion thread
Jul 10th, 2008
0

Php, Mysql and Excel

Expand Post »
I am trying to write or find scripts that will:

1- create a script that will allow someone to Unsubscribe to a mailing list based on email address.

2- export data to a predefined excel file which will be used to print mail labels.

I have looked and looked and have found nothing which works properly.

Thank you for any and help.

Vai
Similar Threads
Vai
Reputation Points: 12
Solved Threads: 5
Junior Poster in Training
Vai is offline Offline
74 posts
since Jan 2008
Jul 10th, 2008
1

Re: Php, Mysql and Excel

do you have a mailing list setup that someone can unsubscribe from. if not, i recommend using www.mailing-manager.com. they will have everything you need.

i have a class to export mysql database to excel file. i have a working example if you need one.
Reputation Points: 235
Solved Threads: 193
Nearly a Posting Virtuoso
kkeith29 is offline Offline
1,315 posts
since Jun 2007
Jul 10th, 2008
0

Re: Php, Mysql and Excel

Keith,

If you have the a working example of exporting mysql data to excel I would appreciate that. The mailing list signup works almost flawlessly.... I just need to get the unsubscribe part working.

Thanks bud
Vai
Reputation Points: 12
Solved Threads: 5
Junior Poster in Training
Vai is offline Offline
74 posts
since Jan 2008
Jul 11th, 2008
0

Re: Php, Mysql and Excel

catch me on skype sometime tomorrow and I will give you the url and credentials to the site. i would post it here but the example is in one of my administrative centers for a site that hasn't gone live yet and I don't want everyone having access.

also, send me your mailing list script so i can add the unsubscribe part.
Last edited by kkeith29; Jul 11th, 2008 at 1:38 am.
Reputation Points: 235
Solved Threads: 193
Nearly a Posting Virtuoso
kkeith29 is offline Offline
1,315 posts
since Jun 2007
Jul 11th, 2008
2

Re: Php, Mysql and Excel

Quote ...
If you have the a working example of exporting mysql data to excel I would appreciate that.
A simple example.
php Syntax (Toggle Plain Text)
  1. <?php
  2. $file="test.xls";
  3. $test="<table border=1><tr><td>Cell 1</td><td>Cell 2</td></tr></table>";
  4. header("Content-type: application/vnd.ms-excel");
  5. header("Content-Disposition: attachment; filename=$file");
  6. echo $test;
  7. ?>
Moderator
Featured Poster
Reputation Points: 524
Solved Threads: 356
Purple hazed!
nav33n is offline Offline
3,878 posts
since Nov 2007
Jul 11th, 2008
0

Re: Php, Mysql and Excel

Nav33n,

That works to open an xls file, w/ cell 1- cell2 but what do I need to do to have actual data displayed from the database?

Thanks again
Vai
Reputation Points: 12
Solved Threads: 5
Junior Poster in Training
Vai is offline Offline
74 posts
since Jan 2008
Jul 11th, 2008
0

Re: Php, Mysql and Excel

Instead of
PHP Syntax (Toggle Plain Text)
  1.  
  2. $test="<table border=1><tr><td>Cell 1</td><td>Cell 2</td></tr></table>";
fetch the data from the database and use it.
php Syntax (Toggle Plain Text)
  1. $text = "Name \t Age \n"; //header
  2. while($row = mysql_fetch_array($result)) {
  3. $text.=$row['name']."\t".$row['age']."\n"; //records
  4. }
Moderator
Featured Poster
Reputation Points: 524
Solved Threads: 356
Purple hazed!
nav33n is offline Offline
3,878 posts
since Nov 2007
Jul 11th, 2008
0

Re: Php, Mysql and Excel

Click to Expand / Collapse  Quote originally posted by nav33n ...
php Syntax (Toggle Plain Text)
  1. $test="<table border=1><tr><td>Cell 1</td><td>Cell 2</td></tr></table>";
Wow! That really works! I've always done just plain csv files, I didn't know you could use html. You've made my day.
php Syntax (Toggle Plain Text)
  1. <?php
  2. $file="test.xls";
  3. header("Content-type: application/vnd.ms-excel");
  4. header("Content-Disposition: attachment; filename=$file");
  5. ?>
  6. <table cellpadding="0" cellspacing="0">
  7. <tr>
  8. <td>cell one</td>
  9. <td>cell two</td>
  10. <td>cell three</td>
  11. <td>cell four</td>
  12. </tr>
  13. <tr>
  14. <td colspan="4" align="center"><b>cell one</b></td>
  15. </tr>
  16. <tr>
  17. <td>cell one</td>
  18. <td>cell two</td>
  19. <td>cell three</td>
  20. <td>cell four</td>
  21. </tr>
  22. </table>

Freaking cool man! Thx.
Reputation Points: 358
Solved Threads: 89
Posting Shark
R0bb0b is offline Offline
986 posts
since Jun 2008
Jul 11th, 2008
0

Re: Php, Mysql and Excel

You are welcome!
Moderator
Featured Poster
Reputation Points: 524
Solved Threads: 356
Purple hazed!
nav33n is offline Offline
3,878 posts
since Nov 2007
Feb 16th, 2011
0
Re: Php, Mysql and Excel
Hi,

I am using the same headers to generate the excel file, which works pretty fine. The problem is tht my org. is migrating to Office 2010, which means using excel 2010. Now, the application generated .xls files, which, when opened in excel 2010, gives a warning message saying something to the tune of "the format is not compatible. verify if the file is correct". If i click on yes, file opens without hassles. How do i make my file compatible to Office 2010?
Reputation Points: 10
Solved Threads: 0
Newbie Poster
sumitgupta225 is offline Offline
2 posts
since Feb 2011

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: Adding user to MySql
Next Thread in PHP Forum Timeline: Pass Variables from One Page to Another





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC