Page 1 of 1

PHP While Loop and Send Email Help Needed Please

Posted: Fri Oct 17, 2003 2:32 pm
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 :(

Posted: Fri Oct 17, 2003 2:38 pm
by qads
$sql2 = "select Email from Mail order by Name ASC limit 0, 50";

Thank You Very Much ! ! !

Posted: Fri Oct 17, 2003 3:15 pm
by welson
A thousand thanks for your contribution and helps.

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

Thanks
Welson

Posted: Fri Oct 17, 2003 6:33 pm
by qads
np :D