0) { break; } } $print = ($count == 1) ? '1 ' . substr($name, 0, -1) : $count . " " . $name; if ($i + 1 < $n) { $seconds2 = $context[$i + 1][0]; $name2 = $context[$i + 1][1]; if (($count2 = floor(($difference - ($seconds * $count)) / $seconds2)) > 0) { $print .= ($count2 == 1) ? ' 1 ' . substr($name2, 0, -1) : " " . $count2 . " " . $name2; } } return $print; } /* Now if we were use this in a page (the above is a custom function and needs to be included in whatever page you use it in) We would need to write the following... */ mysql_connect("localhost", "ian", "j******") or die(mysql_error()); mysql_select_db("ian") or die(mysql_error()); $sql = "SELECT LastActive FROM staff WHERE Username = 'xamanning'"; if($query = mysql_query($sql)) { while($user = mysql_fetch_assoc($query)) echo "Xan was last active " . LastActive($user['LastActive']) . " ago."; } else die('User Tracking Error!'); mysql_close(); /* The Result I got from doing this produced the following "Xan was last active 10 minutes 41 seconds ago." (How long it took to write this page) */ ?>