Topic: Most users online mod

Trying to use an old mod found here http://punbb.org/forums/viewtopic.php?id=3439

The problem I'm having is that it doesn't write any values to the database and is only displaying the current number of users online in the place where it should display the most users ever online.

The code to add the value to the database is

// Most users-mod START
    // Set up the query and get the data
    $result = $db->query('SELECT * FROM '.$db->prefix.'most_users') or error('Unable to fetch most users online data', __FILE__, __LINE__, 

$db->error());

    $max_users_online = $db->fetch_assoc($result);
    // Add users and guests ´to $currently_online.
    // If you don't want to include guests, remove ' + $num_guests' below..
    $currently_online = $num_users + $num_guests;
    // If the amount of currently online users are more or equal to what was previously recorded..
    if ($currently_online>=$max_users_online['most_online']) 
    {
        // Set the time
        $max_users_online['when_was_it'] = time();
        // Set the amount of online users
        $max_users_online['most_online'] = $currently_online;
        // Store it in the table
        $db->query('UPDATE '.$db->prefix.'most_users SET most_online='.$currently_online.', when_was_it='.$max_users_online['when_was_it']) or error('Unable to update most users online data', __FILE__, __LINE__, $db->error());
    }
    // Most users-mod END

And the code to display it on the index page is

// MostUsers-mod START
    // Display what is currently stored in the table (using punBB date format).
    echo "\t\t\t\t\t\t".'<br>'.$lang_index['Most users'].'<strong>'.$max_users_online['most_online'].'</strong> ('.format_time($max_users_online['when_was_it']).').'."\n";
    // MostUsers-mod END

Re: Most users online mod

Never mind, it started working for some reason. I think I had the table wrong.