Replace withCode:$timeDiff($timet,$time);
Paste the whole function please.Code:timeDiff($timet,$time);
Replace withCode:$timeDiff($timet,$time);
Paste the whole function please.Code:timeDiff($timet,$time);
Jeremy | jfein.net
nothing changed![]()
maybe function must be written differently?
PHP Code:
<?php
include('db_conn.php');
$queryget = mysql_query("SELECT * FROM reg_users ORDER BY `time` LIMIT 10") or die("Error with query");
while ($row = mysql_fetch_array($queryget))
{
$nick = $row['Nick'];
$time = $row['time'];
$timet = date("H:i:s");
function timeDiff($firstTime,$lastTime)
{
$firstTime=strtotime($firstTime);
$lastTime=strtotime($lastTime);
$timeDiff=$lastTime-$firstTime;
return $timeDiff;
timeDiff($timet,$time);
}
if (timeDiff($timet,$time)) {
echo "
<table width='200px';>
<tr>
<td align='center';>
<font size='0.8' face='Verdana' color='blue'><b>
$nick
</b></font>
</td>
</tr>
</table><br>
";
} else { }}
?>
Like I said before, move the function outside of the while loop like so:
Code:<?php include('db_conn.php'); $queryget = mysql_query("SELECT * FROM reg_users ORDER BY `time` LIMIT 10") or die("Error with query"); function timeDiff($firstTime,$lastTime) { $firstTime=strtotime($firstTime); $lastTime=strtotime($lastTime); $timeDiff=$lastTime-$firstTime; return $timeDiff; } while ($row = mysql_fetch_array($queryget)) { $nick = $row['Nick']; $time = $row['time']; $timet = date("H:i:s"); if (timeDiff($timet,$time)) { echo " <table width='200px';> <tr> <td align='center';> <font size='0.8' face='Verdana' color='blue'><b> $nick </b></font> </td> </tr> </table><br> "; } else { }} ?>
"Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design
auriaks (11-12-2009)
youre the man !!![]()
thanks both of you guys, really
![]()
Haha, it wasn't me... 0.o TheTestingSite really did it.
Please set your post to resolved by editing your first post, and changing the suffix. Good luck.
Jeremy | jfein.net
ok![]()
Bookmarks