PHP While Loop and Send Email Help Needed Please

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
welson
Forum Newbie
Posts: 4
Joined: Sat Oct 11, 2003 9:25 am

PHP While Loop and Send Email Help Needed Please

Post by welson »

Greeting Everybody,

Could anyone please help me on this while loop?

I had this script from somewhere, It send email to ALL the Contact in the list.

$sql2 = "select Email from Mail order by Name";
$res2 = mysql_query($sql2) or die("Couldn't get addresses.");
$headers ="From: Account Department";

while ($row = mysql_fetch_array($res2)) {
$email_addr = $row[0];
$fullmessage = $_POST[message] ;

mail("$email_addr", "$_POST[subject]", $fullmessage, $headers);
}
echo "email sent!";


But, could anyone please teach me on HOW to limit it ONLY send email to 50 person on the list.

Thanks for who every going to teach me.

Welson :(
qads
DevNet Resident
Posts: 1199
Joined: Tue Apr 23, 2002 10:02 am
Location: Brisbane

Post by qads »

$sql2 = "select Email from Mail order by Name ASC limit 0, 50";
welson
Forum Newbie
Posts: 4
Joined: Sat Oct 11, 2003 9:25 am

Thank You Very Much ! ! !

Post by welson »

A thousand thanks for your contribution and helps.

I had tested it and it work exactly what I want.

Thanks
Welson
qads
DevNet Resident
Posts: 1199
Joined: Tue Apr 23, 2002 10:02 am
Location: Brisbane

Post by qads »

np :D
Post Reply