Php, easy question, but urgent..., please help me

message from Pluda on 15 Jul 2004
Hello,

I'm querying my database, to achieve Name and Email using this:

$query = "SELECT Nome, Email FROM emails";
$result = mysql_query($query);

if (mysql_num_rows($result) > 0) {

$counter=1;

while($row = mysql_fetch_assoc($result)){
$nome_destino .= "".$row["Nome"]."";
$email_destino .= "".$row["Email"]."";

$counter++;
}
echo ($nome_destino | $email_destino);
}
but I get all the names and all the emails whithout having them like

eu@ip.pt
tu@ip.pt
ele@ip.pt

What I get is:

eu@ip.pttu@ip.ptele@ip.pt

I need this to make a mailing list, so my php can email to each my mailing

mail($email_destino, "Ml teste de $date", $body, $from);

Can you please?

Thanks
 
N Rohler replied to Pluda on 15 Jul 2004
Send a separate message for each email... see attached code.

$query = "SELECT Nome, Email FROM emails";
$result = mysql_query($query);

if (mysql_num_rows($result) > 0) {
$counter=1;

while($row = mysql_fetch_assoc($result)){
$nome_destino .= $row["Nome"];
$email_destino .= $row["Email"];
mail($row["Email"], "Ml teste de $date", $body, $from);

$counter++;
 

Archived message: Php, easy question, but urgent..., please help me (Macromedia Dreamweaver)