math compoundingwrong results.

[email protected] (Eric Porter)
Newsgroups php.general
Message-ID <[email protected]>
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/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.