Jump to content

Total Members… counter


Mouse

Recommended Posts

Total Members…

I am just implementing a counter or two on my site… always a good way to promote membership and advertising revenue…

The bit that I cant work out is how to display the number of members on my site whats the magic code to retrieve and echo the highest number in the $u_id column in my “user” table, i.e the number of members?

Mouse
Link to comment
Share on other sites

try

SQL:
[!--sql--][div class=\'sqltop\']SQL[/div][div class=\'sqlmain\'][!--sql1--][span style=\'color:blue;font-weight:bold\']select[/span] [color=blue]count[/color](u_id) [color=green]as[/color] usercount [color=green]from[/color] [color=orange]user[/color] [!--sql2--][/div][!--sql3--]

or something like:

PHP:
[code]
$result = mysql_query("select u_id from user");
$members = mysql_num_rows($result);
[/code]

Link to comment
Share on other sites

[!--quoteo(post=357558:date=Mar 23 2006, 12:08 PM:name=redbullmarky)--][div class=\'quotetop\']QUOTE(redbullmarky @ Mar 23 2006, 12:08 PM) [snapback]357558[/snapback][/div][div class=\'quotemain\'][!--quotec--]
try

SQL:
[!--sql--][div class=\'sqltop\']SQL[/div][div class=\'sqlmain\'][!--sql1--][span style=\'color:blue;font-weight:bold\']select[/span] [color=blue]count[/color](u_id) [color=green]as[/color] usercount [color=green]from[/color] [color=orange]user[/color] [!--sql2--][/div][!--sql3--]

or something like:

PHP:
[code]
$result = mysql_query("select u_id from user");
$members = mysql_num_rows($result);
[/code]
[/quote]
AHHHHHH!!!! I SEE MY ERROR... I FORGOT THE "" ARROUND THE SELECT STATEMENT oh foolish me!

many thanks

Mouse
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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...

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.