Re: mail() and arrays
| From: | Joe Stump | Date: | Thu, 19 Oct 2000 18:33:09 +0000 |
| Subject: | Re: mail() and arrays | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-21228@lists.php.net to get a copy of this message | ||
hhhmmm say you have a table like this
email,username, etc, etc.
$sql = "SELECT email FROM addresses";
$r = mysql_query($sql);
while($row = mysql_fetch_array($r)){
$email = $row['email'];
mail($email,'Hey!','Foobar Message','From: Your Name
<you@server.com>');
}
that will send an email to all people in a db.
to load all into an array do this (this is NOT a good idea)
$sql = "SELECT email FROM addresses";
$r = mysql_query($sql);
while($row = mysql_fetch_array($r)){
$emails[] = $row['email'];
}
mail(implode(', ',$emails),'subject','msg','From: Your Name
<you@server.com');
--Joe
On Thu, Oct 19, 2000 at 12:22:12PM -0700, Dallas Kropka wrote:
> The question has more to do with arrays than mail.... I want to put all the email addresses
> into an array from an sql db, assign all the values to individual variables, insert those variables
> into the mail function, and then mail to all at once...
>
> can someone please point me in the right direction?
/*****************************\
* Joe Stump *
* www.Care2.com *
* Office: 650.328.0198 *
* Extension: 122 *
\*****************************/
http://www.miester.org/Joe/Stump/Joe_Stump_resume.html
-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GB/E/IT d- s++:++ a? C++++ UL++$ P+ L+++$ E----! W+++$
N+@ o? K? w---! O-@ M+@ V-! P(++) PE(+) Y+@ PGP+++@ t+@
5? R-! tv@ b+ DI++@ D(++++) G++@ e+@ h@ r+! z(+++++**)!
------END GEEK CODE BLOCK------