?

Search Help Board

PHP FAQ
PHP Articles
PHP Help
Bulletin Board

PHP Manual (NEW!)
First Time PHP'ers
Help with programming
Sql assignment help
PHP Homework Help


C# Help

?
?db variable in mail function
Author:??(---.doth.centurytel.net)
Date:???07-14-03 03:02

This is probaly very simple. Here's the code:

*************************************************

//Find the right members to send ad to...

$query = 'Select * from members Where (status = "VERIFIED") and (vacation = "OFF") and ((type = "FREE") OR (type = "PRO"))';

$result = mysql_db_query($database,$query,$db);

//As long as there are records...

while ($row = mysql_fetch_array($result)){

//...send mail...



mail ("HERE IS MY PROBLEM", "$subject", "$adbody", "From: WHOEVER");

********************************************************

How do I insert the email address from the db where it says HERE IS MY PROBLEM.

?Re: db variable in mail function
Author:??(---.bluecom.no)
Date:???07-14-03 05:46

Add the mail function in your WHILE statment.
Eg.
If your table looks something like this:
id - mail - field3 - field4
Then the mail address is the second one in the array, since arrays uses [0] and up - the e-mail will be in $row[1]

while ($row = mysql_fetch_array($result)){
$email = $row[1];
mail ("HERE IS MY PROBLEM", "$subject", "$email", "From: WHOEVER");
}

?Re: db variable in mail function
Author:??(---.cpe.net.cable.roger)
Date:???07-14-03 06:23

would have been okay if you recognized that the format for your mail solution was off...

mail(to, subject, body, optional header(ie from)) is the specified format so the correct solution is:

while ($row = mysql_fetch_array($result)){
$email = $row[1];
mail($email, $subject", $body, "From: WHOEVER");
}

?Re: db variable in mail function
Author:??(---.doth.centurytel.net)
Date:???07-21-03 07:39

Thanks, This was just what I needed.

Go to Top??|??Go to Topic??|??Threaded View??|??Search?
??|??
New Topic
?Reply To This Message
?Your Name:
?Your Email:
?Subject:
Email replies to this thread, to the address above.
??

Provided By
Phorum