troubleshooting Question

IS this code correct?

Avatar of alicca
aliccaFlag for Malaysia asked on
Web Languages and StandardsPHP
5 Comments2 Solutions321 ViewsLast Modified:
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

ASKER CERTIFIED SOLUTION
Ashish Patel

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 2 Answers and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros