Jump to content

[SOLVED] Dont Extract TIMESTAMP -5 Minutes


Daney11

Recommended Posts

Hey Guys,

 

Having trouble with my who's online script. Basically i want to echo out users who have been online within the last 5 minutes from my database, but no echo out people who havent been online in the last 5 minutes...

 

My code is..

 

<?php

$inactive = time()-(60*60*5);

$strQuery = "SELECT * FROM managers WHERE manager_time > $inactive ORDER BY manager_time DESC";
$result = mysql_query($strQuery,$db) or die(mysql_error());

while ($myrow = mysql_fetch_array($result))

{

?>

<td width="100"><?php echo stripslashes(date('H:i:s', $myrow['manager_time'])); ?></td>

<?php

}

?>

However, this gets all managers out of the database reguardless of what time they have been online... Any ideas guys..

 

Thanks

 

Dane

Link to comment
https://forums.phpfreaks.com/topic/37847-solved-dont-extract-timestamp-5-minutes/
Share on other sites

Change it to an INT and see if it works better?

 

What is the value of $myrow['manager_time'] for the ones you're not expecting to get?

Also, what is the value of $inactive?

print the sql statement to make sure it's right.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.