NB: I'm a beginner at php programming.
Hi, I've been trying to add an 'Online' or 'Offline' plugin to my login system. To display the username you use thr following:
$session->username
In the database, I have a table for active users. When a user logs in, he is added to that table and when a user logs out then he is removed from that table. The table name is 'blog_active_user'.
I've tried something like:
<?php
$query = "SELECT username FROM blog_active_users"
if($query == $session->username){
echo '<p>User is online</p>';
}
else '<p>User if offline</p>';
}
?>
But then I get an error: Parse error: syntax error, unexpected 'if' (T_IF) in /home/********/public_html/main.php on line 47.
Please could someone help.