The following php script successfully e-mails both messages but it doesn't
update in the table "scr_149" the column "notified". Why?
<?php
// file: "root/adm/e_mail.php", updated: 01/05/02
$connection=mysql_connect("localhost","wagner","123") or die ("No
connection!");
// db
$db=mysql_select_db("sbwresearch_com",$connection) or die ("No database!");
// done
$message_1="
Congratulations!\n\n
You've qualified to take the online survey # 149.\n\n
To take the survey, go to www.sbwresearch.com and click on Survey / Tests.\n\n
";
$message_2="
Sorry!\n\n
You've not qualified to take the online survey # 149.\n\n
We'll notify you by e-mail of upcoming screeners.
";
$qry_1="select * from scr_149 where q05a!=\"0\" && notified=\"n\"";
$qry_2="update scr_149 set notified='y' where username='$username'";
$result_1=mysql_query($qry_1,$connection) or die ("No query # 1!");
while ($row_1=mysql_fetch_array($result_1, MYSQL_ASSOC))
{
$username=$row_1["username"];
$e_mail=$row_1["e_mail"];
mail("$e_mail",
"News from SBW Research",
"$message_1",
"From:SBW Research <[EMAIL PROTECTED]>\n");
$result_2=mysql_query($qry_2,$connection) or die ("No query # 2!");
};
mysql_free_result($result_1);
$qry_3="select * from scr_149 where q05a=\"0\" && notified=\"n\"";
$qry_4="update scr_149 set notified=\"y\" where username='$username'";
$result_3=mysql_query($qry_3,$connection) or die ("No query # 3!");
while ($row_2=mysql_fetch_array($result_3, MYSQL_ASSOC))
{
$username=$row_2["username"];
$e_mail=$row_2["e_mail"];
mail("$e_mail",
"News from SBW Research",
"$message_2",
"From:SBW Research <[EMAIL PROTECTED]>\n");
$result_4=mysql_query($qry_4,$connection) or die ("No query # 4!");
};
@mysql_free_result($result_3);
@mysql_close($connection);
header ("location:done.htm");
exit;
?>
Thanks!
Anthony F. Rodriguez
([EMAIL PROTECTED])
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php