Tulungo
01-19-2010, 10:41 PM
Ok i got a problem, i need to select a name to include in the message
the code looks like this:
$data =date("m", time());
$data1=date("d",time());
mysql_select_db( $db, $link ) or die ( "Couldn't open $db: ".mysql_error() );
$result = mysql_query( "SELECT Nome, Email FROM funcionarios where extract(day from Data_de_Nascimento)='$data1' and extract(month from Data_de_Nascimento)='$data' order by Data_de_Nascimento" );
$num_rows = mysql_num_rows( $result );
while ( $row = mysql_fetch_array( $result ) )
{
$to .= $row[Email] . ',';
rtrim($to, ',');
$na .= $row[Nome] . ','; //Name
rtrim($na, ',');
}
$sub="Feliz aniversario";
ini_set('SMTP', 'mail.clix.pt');
$subject = "$sub";
$message = "Sr. $na a fastforward ................................ Feliz aniversario";
$headers = 'From: bitlo@clix.pt' . "\r\n" .
'Reply-To: bitlo@clix.pt' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
But in the message it apears all the names, and i need to associte a name to a email.....
Can please some one HELP ME!!!!!
the code looks like this:
$data =date("m", time());
$data1=date("d",time());
mysql_select_db( $db, $link ) or die ( "Couldn't open $db: ".mysql_error() );
$result = mysql_query( "SELECT Nome, Email FROM funcionarios where extract(day from Data_de_Nascimento)='$data1' and extract(month from Data_de_Nascimento)='$data' order by Data_de_Nascimento" );
$num_rows = mysql_num_rows( $result );
while ( $row = mysql_fetch_array( $result ) )
{
$to .= $row[Email] . ',';
rtrim($to, ',');
$na .= $row[Nome] . ','; //Name
rtrim($na, ',');
}
$sub="Feliz aniversario";
ini_set('SMTP', 'mail.clix.pt');
$subject = "$sub";
$message = "Sr. $na a fastforward ................................ Feliz aniversario";
$headers = 'From: bitlo@clix.pt' . "\r\n" .
'Reply-To: bitlo@clix.pt' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
But in the message it apears all the names, and i need to associte a name to a email.....
Can please some one HELP ME!!!!!