math compoundingwrong results.

From: Date: Thu, 18 May 2000 12:17:24 +0000
Subject: math compoundingwrong results.
Groups: php.general 
Request: Send a blank email to php-general+get-153@lists.php.net to get a copy of this message
Hello I am having a math problem with hte following. The date(), only happens during the first loop and the result keeps compounding. How can I force it to happen everytime? I tired an Unset() o nhte $date, it didnt work. Ideas? Eric while($row = mysql_fetch_array($result)) { $query1 = "SELECT * FROM members WHERE username = '$row[username]' "; $result1 = mysql_query($query1); $row1 = mysql_fetch_array($result1); $query2 = "SELECT * FROM pictures WHERE username = '$row[username]' "; $result2 = mysql_query($query2); $row2 = mysql_fetch_array($result2); print "<tr>"; print "<td width=18%>"; print "<a href=*.php3?susername="; print "$row[username]"; print ">"; echo $row[username]; print "</a></td>"; print "<td width=9%>"; echo $row1[memmdl]; print "</td>"; print "<td width=25%>"; echo $row1[memyr]; print "</td>"; print "<td width=24%>"; if (empty($row2[picture_name])) { print "no picture <img src=http://www.ultimatenetwork.net/nphoto.gif>";} else{print "yes picture <img src=http://www.ultimatenetwork.net/photo.gif>";} print "</td>"; print "<td width=24%>"; $query3 = "SELECT * FROM whos WHERE username = '$row[username]' "; $result3 = mysql_query($query3); $row3 = mysql_fetch_array($result3); $hour2 = (int)substr($row3[entry], 8, 2); $minute2 = substr($row3[entry], 10, 2); if ( $minute2 < 10) { $minute2= "0$minute2"; } $date = getdate(); $minutes = $date[ 'minutes']; $hours = $date[ 'hours']; if ( $minutes < 10) { $minutes= "0$minutes"; } if ($mintues < $minute2) { $nhours = $hours -1; $nminutes = $mintues +60; $rhour = $nhours - $hour2; $rmin = $nminutes - $minute2; }else{ $rhour = $hours - $hour2; $rmin = $minutes - $minute2; } if ($rhour < 1) { print $rmin; print " mintues"; } else { print $rhour; print " hours "; print $rmin; print " minutes"; } print "</td>"; print "</tr>"; } print "</table>"; __________________________________________________ Do You Yahoo!? Send instant messages & get email alerts with Yahoo! Messenger. http://im.yahoo.com/

« previous php.general (#153) next »