// Checks if USERNAME is set in the session if(isset($_SESSION['USERNAME'])){ // Grabs username that are unique from the lastactive table, where the date_now is greater than the current datetime $stmt = $pdo->prepare("SELECT DISTINCT username from lastactive where date_now > now() - INTERVAL 15 MINUTE;"); $stmt->execute(); // Prints out Online Users: as an h4 element with the id of who_title echo "

Online Users

\n"; // Creates ul element echo "\n"; }