I have this code:
<?php
$result_array1 = array();
$sql1 = "SELECT * FROM `test_thing`";
$result1 = mysql_query("$sql1") or die($sql1.mysql_error());
while($row1 = mysql_fetch_array($result1))
{
$result_array1[] = $row1['email'];
}
$sentmail = mail($result_array1,$subject,$message,$header);
?>
My problem is that if I place the mail function inside the loop, the user receives many emails instead of one, and if I place it out of the loop, no email is sent. My aim is to send only 1 email to each user, but that email should containt in it many mixed emails. I have read in other forums that it can be done using arrays. Maybe there is a mistake with the codes. Any suggestions?
Thanks
mysql_fetch_associnstead ofmysql_fetch_array?mysql_fetch_array()gets both associative and numeric keys so this works fine.