Jump to content
MakeWebGames

[mccode] Main menu users online count


Modern-Empires

Recommended Posts

Re: main menu users online count

 

It'll almost work

Change

$var = mysql_num_rows($sql);

to

$var = mysql_fetch_assoc($sql);

And it will. Also there's no need to use sprintf on that, since you're putting the 900 in directly

why assoc? If you look into the database class at the fetch_row function it will have MYSQL_ASSOC on by default..

Link to comment
Share on other sites

Re: [mccode] Main menu users online count

oops i made a mistake, i thought the mccodes database class had it but i am wrong. In my database class for fetchRow is have this and as default it will have assoc selected instead of MYSQL_NUM

function fetchRow($type='MYSQL_ASSOC') { return mysql_fetch_array($this->result_id,$type); }

Link to comment
Share on other sites

Re: [mccode] Main menu users online count

 

This mod i made from scratch, i will tell you how many poeple are onlineon the main menu.

Open Main Menu

Find the line:

$mc=$ir['new_mail'];

add under:

$var2['num_users_on'] = mysql_query("SELECT userid FROM users WHERE laston >= UNIX_TIMESTAMP()-900", $c);

$var['num_users_on'] = mysql_num_rows($var2['num_users_on']);

and put this anywhere on the links in main menu:

Users Online ({$var['num_users_on']})

 

This mod was made by me Peter Greenacre

First Placed on modern-empires

http://www.modern-empires.site40.net

Yeah nice, could also be done on login page :) with a few little edits xD

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...