Please check this program (its working)

From: Date: Fri, 09 Jan 2004 07:20:09 +0000
Subject: Please check this program (its working)
Groups: php.general 
Request: Send a blank email to php-general+get-174092@lists.php.net to get a copy of this message
Hi, I dont know if this is the right way to do this, so please have a looksee and tell me. Its working perfectly well...but will I have problems if I try it on a large email list or will it hog resources....etc? ANY advice appreciated. <?php $hostt="localhost"; $userr="ryan"; $passs="pass"; $db="test"; $connected=mysql_connect ("$hostt", "$userr", "$passs") or die ('DB error: ' . mysql_error()); mysql_select_db ("$db"); $query = "SELECT * FROM testEmail"; $result = mysql_query($query) or die("Error: " . mysql_error()); if($result) { while($row = mysql_fetch_row($result)) { $the_email = $row[0]; echo "Mailing: &nbsp; &nbsp; &nbsp; &nbsp; ".$the_email."<br>"; $subject = "Test subject"; $mailcontent = "blah blah blah blah blah"; $mail_from="Ryan the great <foo@bar.com>"; $headers="From: ".$mail_from."\n"."Return-Path: ".$mail_from."\n"."Reply-To: ".$mail_from."\n"; mail($the_email,$subject,$mailcontent,$headers); } }else{echo "no result";} ?> The reason I used mysql_fetch_row is I thought I might make it more personalized a bit later...to greet each person in my database by name. Thanks, -Ryan

« previous php.general (#174092) next »