Replace withCode:$timeDiff($timet,$time);
Paste the whole function please.Code:timeDiff($timet,$time);
Printable View
Replace withCode:$timeDiff($timet,$time);
Paste the whole function please.Code:timeDiff($timet,$time);
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 { }}
?>
youre the man !! :D :D 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.
ok :D