Hi,
In one of our tables we have these fields:
cust_no bigint(20),
cust_name varchar(30),
last_online datetime,
and in that members profile, if someone visits it, on the top of the page we
have this:
// connect to db, query for record and display it below
Last seen: ?php echo $last_online; ?
I'd probably out how many minutes it's been, then format it using if
statements.
$iMinues = (value from database);
if(1 $iMinutes) $sLastseen = 'Less than a minute ago!';
elseif(1 == $iMinutes) $sLastseen = '1 minute ago';
elseif(60 $iMinutes) $sLastseen = {$iMinutes} minutes ago;
elseif(120
methinks you should convert the datetime to a unix timestamp with
strtotime(). then you can compare the difference between this
timestamp and a unix timestamp of now to find if you have logged in
within a min. of the previous time. Then, once you know what text to
display (e.g. Less than a
3 matches
Mail list logo