Hello Dave,

Tuesday, February 15, 2005, 8:37:02 AM, you wrote:
D>     while ($tantoData = mysql_fetch_array($tantoResult))
D>     {
D>         $tantoEmail = $tantoEmail . "," . $tantoData;
D>     }

D>     mail($tantoEmail, $subject, $mailcontent, $addHeaders);


Everything looked good up to here.


$tantoEmail = $tantoEmail . "," . $tantoData['email'];

I'm not that great at SQL syntax, but this should work. That'll at
least get your e-mail addresses in there. The next problem is that,
and for purposes of demonstration we'll say you pulled out three
addresses, you're going to have a comma before the first e-mail
address.

i.e.

,address1,address2,address3

because the first time through the while, $tantoEmail is empty, then
you put a comma and the first address.

So, you'd need to $tantoEmail = ltrim($tantoEmail, ","); that.

You can further shorten that to:
$tantoEmail .=  "," . $tantoData['email'];

but you'd still need to ltrim that to get rid of the first comma.

Another way to do this to avoid having to worry about that pesky
comma. 

while ($tantoData = mysql_fetch_array($tantoResult))
{
    if ($tantoEmail != "")
       $tantoEmail .=  "," . $tantoData['email'];
    else
       $tantoEmail = $tantoData['email'];
}


--
Leif (TB lists moderator and fellow end user).

Using The Bat! 3.0.2.3 Rush under Windows XP 5.1
Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to