Jump to content

Recommended Posts

OK that works ( ithink. )

This is what im attempting, but doesnt seem to work.

 

im doing a select blaa,blaaa,CURRENT_DATE from blaaa;

 

$time = $row['lastseen'];
$cdate = $row['current_date'];

echo $cdate;

if (strtotime($time)-30 > $cdate) {
echo '<td><img src="Images/useronline.png" border="0" /></td>';
}else{
echo '<td><img src="Images/useroffline.png" border="0" /></td>';
}

 

What am i doing wrong?

 

time() contains the current time (obviously). Just compare the lastseen with the current time. The lastseen has to be converted to a UNIX timestamp which is what strtotime does.

 

if (strtotime($time)-30*60 > time()) {
echo '<td><img src="Images/useronline.png" border="0" /></td>';
}else{
echo '<td><img src="Images/useroffline.png" border="0" /></td>';
}

should do it (assuming you mean 30 minutes and not 30 seconds).

Humm using.

 

if (strtotime($time)-30 > time()) {
echo '<td><img src="Images/useronline.png" border="0" /></td>';
}else{
echo '<td><img src="Images/useroffline.png" border="0" /></td>';
}

 

doesnt work.

it still shows the offline image.

 

The timestamp is being updated in the db, and it is in the var as i can echo it.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.