Jump to content

cant understan in while loop


phpmady

Recommended Posts

Hi,

 

I am trying to send to send more than one email in a while loop

 

Only the first row getting executing and remain not, whats am doing wrong

 

pls help me.............below the code i  am using

 

 

$sql2 = "SELECT * FROM maillist where MailListSection_ID=".$MailListSection_ID[$i]." and MailList_UserActive=1";


echo $sql2;


$temps21 = $DB_site->query($sql2);
$nos = $DB_site->num_rows($temps21);


echo $nos;



while ($temp21 = $DB_site->fetch_array($temps21))
{

$recipient= $temp21['MailList_Email'];
$subject= $_POST['subject'];


$html="<html> <body>";
$ehtml="</body></html>";

//----------------------------subject...
$message.=$html.'<p align="left">
<br>
<b> <font color="#6699FF">Greetings from<a href="'.$g_setups['website_link'].'"> '.$g_setups['website_name'].'</a></font></b></p>
<div align="left">
<table border="0" width="350" cellspacing="0" cellpadding="0">



<tr>
	<td width="175">
	<p align="left"><font face="Tahoma" size="2">Subject :</font></td>
	<td><span lang="en-us"><font face="Tahoma" size="2">'.$_POST['subject'].'</font></span></td>
</tr>
<tr>
	<td width="175"><font face="Tahoma" size="2">Message:</font></td>
	<td><span lang="en-us"><font face="Tahoma" size="2">'.$_POST['msg'].'</font></span></td>
</tr>
</table>
</div>
<br>
Thank You
<br>
<b> <font color="#6699FF">'.$g_setups['website_name'].'</font></b></font></p>';
//----------------------------End..subject...

//----------------------------IP...
$message.=$ehtml;
//----------------------------End..IP...


//echo $message;

//exit();




$header="From: ".$g_setups['website_name']." <".$g_setups['website_email']."> \n".
     "Reply-To: ".$g_setups['website_email']." \n".
     "MIME-Version : 1.0 \n".
     "Content-type: text/html ; charset=windows-1256 \n";


mail($recipient, $subject, $message, $header);


echo $recipient; 
echo $message;

$message = "";
$recipient = "";

}
}

 

 

Link to comment
https://forums.phpfreaks.com/topic/199858-cant-understan-in-while-loop/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.