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
https://forums.phpfreaks.com/topic/5579-total-members%E2%80%A6-counter/
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]

[!--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

Archived

This topic is now archived and is closed to further replies.

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