Hello,
I have a script to mail and it works, but there is a problem. I want to mail al the rows from the field, but now I only get one row from the field.
My script is:
-----------------------------
//SQL and database connection
$sql = "SELECT quiz_score.user_id, quiz_score.quiz_id
FROM quiz_score";
$db = new clsDBproeducation();
$db->query($sql);
unset($db);
//to and from
$to = "i.vanderraad@proeducation.nl";
$from = "Ivo van der Raad <raad@quicknet.nl>";
//subject
$subject = "Test mailing";
//message
$result = mysql_query($sql) OR die ("Query failed");
while ($row = mysql_fetch_assoc($result))
{
$message = $row["quiz_id"];
}//end loop
//headers
$headers = "From: $from\nReply-To: $from\nContent-type:text/html";
//mail
mail ($to, $subject, $message, $headers);
-----------------------------
When I end the loop after mail I get all the rows from field quiz_id but not in one E-mail but every row in an other e-mail.
How can I get all the fields in one e-mail?
Kind Regards,
Ivo van der Raad
I have a script to mail and it works, but there is a problem. I want to mail al the rows from the field, but now I only get one row from the field.
My script is:
-----------------------------
//SQL and database connection
$sql = "SELECT quiz_score.user_id, quiz_score.quiz_id
FROM quiz_score";
$db = new clsDBproeducation();
$db->query($sql);
unset($db);
//to and from
$to = "i.vanderraad@proeducation.nl";
$from = "Ivo van der Raad <raad@quicknet.nl>";
//subject
$subject = "Test mailing";
//message
$result = mysql_query($sql) OR die ("Query failed");
while ($row = mysql_fetch_assoc($result))
{
$message = $row["quiz_id"];
}//end loop
//headers
$headers = "From: $from\nReply-To: $from\nContent-type:text/html";
mail ($to, $subject, $message, $headers);
-----------------------------
When I end the loop after mail I get all the rows from field quiz_id but not in one E-mail but every row in an other e-mail.
How can I get all the fields in one e-mail?
Kind Regards,
Ivo van der Raad