Avatar of alicca
alicca
Flag for Malaysia

asked on 

IS this code correct?

i wan to retrive email list from database and send it..
so can some 1 help me check is this code correct?
$reclist = mysql_query("SELECT mailadres FROM signup") 
               or die(mysql_errno()." : ".mysql_error());
 
while($rec=mysql_fetch_assoc($reclist)){
     $emaillist = $rec['mailadres']; 
            
}
 
$allemails = split("\n", $emaillist);
$numemails = count($allemails);
 
          for($x=0; $x<$numemails; $x++){
                $to = $allemails[$x];
                if ($to){
                $to = ereg_replace(" ", "", $to);
  
                flush();
                $header = "From: $realname";
                $header .= "MIME-Version: 1.0\r\n";
	       mail($to, $subject, $messege, $header);
				}
		 }

Open in new window

Web Languages and StandardsPHP

Avatar of undefined
Last Comment
alicca

8/22/2022 - Mon