Hi, I'm building a website for a beauty salon and I need to make a mailinglist.. People can already sign up, but I'm having trouble getting all their email adresses formatted properly into 1 variable so I can send it to all people in one go..
Here is my script so far:
<?php require_once('../Connections/neoderma_nl.php');
mysql_select_db($database_neoderma_nl, $neoderma_nl);
$query_mail = "SELECT naam, email FROM mailinglijst ORDER BY email ASC";
$mail = mysql_query($query_mail, $neoderma_nl) or die(mysql_error());
$row_mail = mysql_fetch_array($mail);
$totalRows_mail = mysql_num_rows($mail);
do {
$naam = $row_mail[0];
$email = $row_mail[1];
$emails[] = $email;
$namen[] = $naam;
} while($row_mail=mysql_fetch_array($mail));
for ($x=0;$x<=$totalRows_mail-1;$x++){
echo $emails[$x];
if ($x<>$totalRows_mail-1){
echo ",";
}
}
mysql_free_result($mail);
?>
The FOR loop generates the proper output.. (email@email.com,email@email.com,email@email.com).. But how do I get all that into one variable?? I'm pretty new to array's I've never really needed them...
I remember seeing something like
$variable = echo something else..
Is this possible at all?