Jump to content


Photo

Total Members… counter


  • Please log in to reply
2 replies to this topic

#1 Mouse

Mouse
  • Members
  • PipPipPip
  • Advanced Member
  • 95 posts
  • LocationToo Close to LONDON

Posted 23 March 2006 - 11:57 AM

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


#2 redbullmarky

redbullmarky
  • Staff Alumni
  • Advanced Member
  • 2,863 posts
  • LocationBedfordshire, England

Posted 23 March 2006 - 12:08 PM

try

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

or something like:

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


"you have to keep pissing in the wind to learn how to keep your shoes dry..."

I say old chap, that is rather amusing!

#3 Mouse

Mouse
  • Members
  • PipPipPip
  • Advanced Member
  • 95 posts
  • LocationToo Close to LONDON

Posted 23 March 2006 - 04:23 PM

[!--quoteo(post=357558:date=Mar 23 2006, 12:08 PM:name=redbullmarky)--][div class=\'quotetop\']QUOTE(redbullmarky @ Mar 23 2006, 12:08 PM) View Post[/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] count(u_id) as usercount from user [!--sql2--][/div][!--sql3--]

or something like:

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

many thanks

Mouse




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users