Hello all...

Im having a bit of trouble with a mysql update feature. What I am doing is 
having a script email a list of people in a database (one email address per 
db record) and have the script update the database that it has sent an 
email to that particular person. Currently I have:

while ($Row = mysql_fetch_array ($Result)) {
         $UserID=$Row->user_id;
         if ($Row[EmailSent] == 0) {
                 if ($Row[email]) {
                         $Msg0 = "Dear $Row[RealName] \n\n";
                         $To = $Row[email];
                         $TotalMsg = "$Msg0$Msg1$Msg2$Msg3$Msg4$Msg5";
                         if (mail($To, $Subject, $TotalMsg, $AddHeaders)) {
                                 ++$Good;
                                 $Query1= "UPDATE $connectdb1 SET 
EmailSent=\"1\" WHERE user_id=\"$UserID\" LIMIT 1";
                                 mysql_query($Query1, $Link);
                         } else {
                                 ++$Bad;
                         }
                 } else {
                         ++$CountNoEmail;
                 }
         } else {
                 ++$CountAlreadySent;
         }
++$CountTotal;
}

What am I doing wrong? can I have multiple incarnations of mysql queries 
like this? How could I get a UserID out of a while statement for later 
updating? Thanks for any help.

--Photocon
Conrad Hunziker III
www.nightskyent.com


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to