User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 425,796 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,148 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 727 | Replies: 8 | Solved
Reply
Join Date: Jan 2008
Posts: 70
Reputation: Vai is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 5
Vai Vai is offline Offline
Junior Poster in Training

Php, Mysql and Excel

  #1  
Jul 10th, 2008
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
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jun 2007
Location: Valley Center, Kansas
Posts: 554
Reputation: kkeith29 is on a distinguished road 
Rep Power: 3
Solved Threads: 57
kkeith29's Avatar
kkeith29 kkeith29 is offline Offline
Posting Pro

Re: Php, Mysql and Excel

  #2  
Jul 10th, 2008
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.
Reply With Quote  
Join Date: Jan 2008
Posts: 70
Reputation: Vai is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 5
Vai Vai is offline Offline
Junior Poster in Training

Re: Php, Mysql and Excel

  #3  
Jul 10th, 2008
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
Reply With Quote  
Join Date: Jun 2007
Location: Valley Center, Kansas
Posts: 554
Reputation: kkeith29 is on a distinguished road 
Rep Power: 3
Solved Threads: 57
kkeith29's Avatar
kkeith29 kkeith29 is offline Offline
Posting Pro

Re: Php, Mysql and Excel

  #4  
Jul 11th, 2008
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 12:38 am.
Reply With Quote  
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,098
Reputation: nav33n has a spectacular aura about nav33n has a spectacular aura about 
Rep Power: 8
Solved Threads: 240
nav33n's Avatar
nav33n nav33n is offline Offline
Posting Sensei

Re: Php, Mysql and Excel

  #5  
Jul 11th, 2008
If you have the a working example of exporting mysql data to excel I would appreciate that.
A simple example.
  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. ?>
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.

*PM asking for help will be ignored*
Reply With Quote  
Join Date: Jan 2008
Posts: 70
Reputation: Vai is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 5
Vai Vai is offline Offline
Junior Poster in Training

Re: Php, Mysql and Excel

  #6  
Jul 11th, 2008
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
Reply With Quote  
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,098
Reputation: nav33n has a spectacular aura about nav33n has a spectacular aura about 
Rep Power: 8
Solved Threads: 240
nav33n's Avatar
nav33n nav33n is offline Offline
Posting Sensei

Re: Php, Mysql and Excel

  #7  
Jul 11th, 2008
Instead of
 
$test="<table border=1><tr><td>Cell 1</td><td>Cell 2</td></tr></table>";
fetch the data from the database and use it.
  1. $text = "Name \t Age \n"; //header
  2. while($row = mysql_fetch_array($result)) {
  3. $text.=$row['name']."\t".$row['age']."\n"; //records
  4. }
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.

*PM asking for help will be ignored*
Reply With Quote  
Join Date: Jun 2008
Location: Phoenix, AZ
Posts: 769
Reputation: R0bb0b is on a distinguished road 
Rep Power: 2
Solved Threads: 63
R0bb0b's Avatar
R0bb0b R0bb0b is offline Offline
Master Poster

Re: Php, Mysql and Excel

  #8  
Jul 11th, 2008
Originally Posted by nav33n View Post
  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.
  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.
“Be who you are and say what you feel because those who mind don't matter and those who matter don't mind.” - Dr. Seuss
Reply With Quote  
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,098
Reputation: nav33n has a spectacular aura about nav33n has a spectacular aura about 
Rep Power: 8
Solved Threads: 240
nav33n's Avatar
nav33n nav33n is offline Offline
Posting Sensei

Re: Php, Mysql and Excel

  #9  
Jul 11th, 2008
You are welcome!
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.

*PM asking for help will be ignored*
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb PHP Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the PHP Forum

All times are GMT -4. The time now is 3:28 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC