Jump to content

Function won't work


Mutley

Recommended Posts

$time = time();
function userOnline($useronline) {
// Check if user is online:
	$result_online = mysql_query("SELECT online FROM users WHERE user_id = '$useronline' LIMIT 1");
	while($row_online = mysql_fetch_array( $result_online ))
    	{
	$online = $row_online['online'];
	}

	if($time - $online < 30) {
	echo "<img src=\"images/online.gif\" alt=\"Online\" /> ";
	} else {
	echo "<img src=\"images/offline.gif\" alt=\"Offline\" /> ";
	}
// End check				
}

 

Then when I use the function it always says there online? However the code works out of function.

Link to comment
https://forums.phpfreaks.com/topic/46107-function-wont-work/
Share on other sites

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.