double mysql calls?

From: Date: Mon, 30 Jul 2001 09:53:02 +0000
Subject: double mysql calls?
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-10897@lists.php.net to get a copy of this message
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

« previous php.db (#10897) next »