RE: [PHP-DB] arrays and email
Hi kevin, Seems like in your while loop, you are not populating your list array correctly with all the emails you have. Try to have a count value and populate the array list accordingly such as: $count = 0; while ($row = mysql_fetch_row($result)) { $real_name = $row[1]; $email = $row[12]; $list[$count] = $email; $count = $count + 1; } Hope this helps. Gurhan -Original Message- From: Kevin Ruiz [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 29, 2002 2:14 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] arrays and email I'm working on an application that will allow someone to view all attendees for a specific webinar that my company is hosting. I want to allow the user to send one group email to all participants scheduled for that particular webinar. After I connect to my database my code looks like this: ? $sql = select * from webusers where webdate=\$webdate\; $result = mysql_query($sql) or die(couldn't generate a list of the users); while ($row = mysql_fetch_row($result)) { $real_name = $row[1]; $email = $row[12]; $list[] = $email; } echo form method=\post\ action=\doemailattendees.php\\n; echo table width=\100%\ border=0 cellspacing=0 cellpadding=0 class=\orange4\\n; echo tr\n; echo td valign=\top\pbTo:/b/p/td\n; echo td valign=\top\p\n; foreach ($list as $value) { print $value, ; $to = $value; } echo /p/td\n; echo /tr\n; echo /table\n; echo table width=\100%\ border=0 cellspacing=0 cellpadding=0\n; echo tr\n; echo td valign=\top\pbSubject:/b/p/td\n; echo td valign=\top\pinput type=\text\ name=\subject\/p/td\n; echo /tr\n; echo tr\n; echo td valign=\top\pbMessage:/b/p/td\n; echo td valign=\top\textarea name=\message\/textarea/td\n; echo /tr\n; echo tr\n; echo td colspan=2 valign=\top\input type=\submit\ value=\submit\/td\n; echo /tr\n; echo /table\n; echo /form\n; ? The $to, $subject, $message variables then get sent to a page that actually mails the message. The problem I'm having is that it's only being sent to the last person in the array. I understand why this is happening but don't know enough about arrays to find a solution. As my code shows I ambitiously tried setting $to to the entire array but that doesn't work. If anyone would be kind enough to help me out I'd greatly appreciate it. Thank you. Kevin www.worktiviti.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] arrays and email
The other thing you could do is populate a string of emails and add the BCC header to your mail() function. This way everyone's email will not be seen by all other recipients. Check out the docs at www.php.net for this one a better way to build the string would probably be: while ($row = mysql_fetch_row($result)) { $real_name = $row[1]; $email_list .= $row[12]; } Then just pass $email_list in the BCC - be careful as some ISP's do not allow mass mailings to be sent in BCC. [i.e. mine is limited to 99 emails and then it gets spam blocked so i must send through the mailing list feature] olinux --- Gurhan Ozen [EMAIL PROTECTED] wrote: Hi kevin, Seems like in your while loop, you are not populating your list array correctly with all the emails you have. Try to have a count value and populate the array list accordingly such as: $count = 0; while ($row = mysql_fetch_row($result)) { $real_name = $row[1]; $email = $row[12]; $list[$count] = $email; $count = $count + 1; } Hope this helps. Gurhan -Original Message- From: Kevin Ruiz [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 29, 2002 2:14 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] arrays and email I'm working on an application that will allow someone to view all attendees for a specific webinar that my company is hosting. I want to allow the user to send one group email to all participants scheduled for that particular webinar. After I connect to my database my code looks like this: ? $sql = select * from webusers where webdate=\$webdate\; $result = mysql_query($sql) or die(couldn't generate a list of the users); while ($row = mysql_fetch_row($result)) { $real_name = $row[1]; $email = $row[12]; $list[] = $email; } echo form method=\post\ action=\doemailattendees.php\\n; echo table width=\100%\ border=0 cellspacing=0 cellpadding=0 class=\orange4\\n; echo tr\n; echo td valign=\top\pbTo:/b/p/td\n; echo td valign=\top\p\n; foreach ($list as $value) { print $value, ; $to = $value; } echo /p/td\n; echo /tr\n; echo /table\n; echo table width=\100%\ border=0 cellspacing=0 cellpadding=0\n; echo tr\n; echo td valign=\top\pbSubject:/b/p/td\n; echo td valign=\top\pinput type=\text\ name=\subject\/p/td\n; echo /tr\n; echo tr\n; echo td valign=\top\pbMessage:/b/p/td\n; echo td valign=\top\textarea name=\message\/textarea/td\n; echo /tr\n; echo tr\n; echo td colspan=2 valign=\top\input type=\submit\ value=\submit\/td\n; echo /tr\n; echo /table\n; echo /form\n; ? The $to, $subject, $message variables then get sent to a page that actually mails the message. The problem I'm having is that it's only being sent to the last person in the array. I understand why this is happening but don't know enough about arrays to find a solution. As my code shows I ambitiously tried setting $to to the entire array but that doesn't work. If anyone would be kind enough to help me out I'd greatly appreciate it. Thank you. Kevin www.worktiviti.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] __ Do You Yahoo!? Great stuff seeking new owners in Yahoo! Auctions! http://auctions.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] arrays and email
It would appear that I should check if anyone else has answered a question first! And get some more sleep! Sorry! Ollie -Original Message- From: olinux [mailto:[EMAIL PROTECTED]] Sent: 29 January 2002 20:05 To: [EMAIL PROTECTED] Subject: RE: [PHP-DB] arrays and email The other thing you could do is populate a string of emails and add the BCC header to your mail() function. This way everyone's email will not be seen by all other recipients. Check out the docs at www.php.net for this one a better way to build the string would probably be: while ($row = mysql_fetch_row($result)) { $real_name = $row[1]; $email_list .= $row[12]; } Then just pass $email_list in the BCC - be careful as some ISP's do not allow mass mailings to be sent in BCC. [i.e. mine is limited to 99 emails and then it gets spam blocked so i must send through the mailing list feature] olinux --- Gurhan Ozen [EMAIL PROTECTED] wrote: Hi kevin, Seems like in your while loop, you are not populating your list array correctly with all the emails you have. Try to have a count value and populate the array list accordingly such as: $count = 0; while ($row = mysql_fetch_row($result)) { $real_name = $row[1]; $email = $row[12]; $list[$count] = $email; $count = $count + 1; } Hope this helps. Gurhan -Original Message- From: Kevin Ruiz [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 29, 2002 2:14 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] arrays and email I'm working on an application that will allow someone to view all attendees for a specific webinar that my company is hosting. I want to allow the user to send one group email to all participants scheduled for that particular webinar. After I connect to my database my code looks like this: ? $sql = select * from webusers where webdate=\$webdate\; $result = mysql_query($sql) or die(couldn't generate a list of the users); while ($row = mysql_fetch_row($result)) { $real_name = $row[1]; $email = $row[12]; $list[] = $email; } echo form method=\post\ action=\doemailattendees.php\\n; echo table width=\100%\ border=0 cellspacing=0 cellpadding=0 class=\orange4\\n; echo tr\n; echo td valign=\top\pbTo:/b/p/td\n; echo td valign=\top\p\n; foreach ($list as $value) { print $value, ; $to = $value; } echo /p/td\n; echo /tr\n; echo /table\n; echo table width=\100%\ border=0 cellspacing=0 cellpadding=0\n; echo tr\n; echo td valign=\top\pbSubject:/b/p/td\n; echo td valign=\top\pinput type=\text\ name=\subject\/p/td\n; echo /tr\n; echo tr\n; echo td valign=\top\pbMessage:/b/p/td\n; echo td valign=\top\textarea name=\message\/textarea/td\n; echo /tr\n; echo tr\n; echo td colspan=2 valign=\top\input type=\submit\ value=\submit\/td\n; echo /tr\n; echo /table\n; echo /form\n; ? The $to, $subject, $message variables then get sent to a page that actually mails the message. The problem I'm having is that it's only being sent to the last person in the array. I understand why this is happening but don't know enough about arrays to find a solution. As my code shows I ambitiously tried setting $to to the entire array but that doesn't work. If anyone would be kind enough to help me out I'd greatly appreciate it. Thank you. Kevin www.worktiviti.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] __ Do You Yahoo!? Great stuff seeking new owners in Yahoo! Auctions! http://auctions.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]