Re[2]: [PHP] while loop with mysql

From: Date: Mon, 10 Mar 2003 09:55:13 +0000
Subject: Re[2]: [PHP] while loop with mysql
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-138937@lists.php.net to get a copy of this message
Hello Tom, I have been looking at this for an hour and thought it was something like that but I could not see it. I guess it is time to go to bed. Thanks Monday, March 10, 2003, 1:47:27 AM, you wrote: TR> Hi, TR> Monday, March 10, 2003, 7:20:37 PM, you wrote: RK>> Can somebody look at this and tell me way the first while loop will RK>> only loop through the database once when there is more than one record RK>> that should be processed. RK>> while($members = @mysql_fetch_object($result)) { RK>> $logged_email=$members->email; RK>> $logged_title=$members->title; RK>> $logged_first_name=$members->first_name; RK>> $logged_last_name=$members->last_name; RK>> $logged_time=$members->mtime; RK>> $logged_date=$members->signdate ; RK>> $logged_sent=$members->sent; RK>> $current_time = time(); RK>> $high_level = $current_time - $logged_time; RK>> $low_level = $high_level - 86400; RK>> $result1=safe_query("Select * from email"); RK>> while ($emails = @mysql_fetch_object($result1)) { RK>> $keys= $emails->days_send; RK>> $keys=trim($keys); RK>> $sendoff = $keys * 86400; RK>> if ($sendoff > $low_level) { RK>> if ($sendoff < $high_level) { RK>> $logged_sent=trim($logged_sent); RK>> if ($logged_sent==$keys){ RK>> }else{ RK>> //update the members table sent field with the key # RK>> $sql1="Update members set sent='$keys' where RK>> email='$logged_email'"; RK>> $result=safe_query($sql1); RK>> send_email(); RK>> }}}//end of all three if statements RK>> }//end of $emails while loop RK>> } //end $members while loop RK>> -- RK>> Best regards, RK>> Richard mailto:rdkurth@starband.net-”9º RK>> dÌÌ­¦F>Ë'ã TR> This resets $result TR> //update the members table sent field with the key # TR> $sql1="Update members set sent='$keys' where TR> email='$logged_email'"; TR> $result=safe_query($sql1); TR> send_email(); TR> needs $result3 or something -- Best regards, Richard mailto:rdkurth@starband.net

« previous php.general (#138937) next »