Mouse Posted March 23, 2006 Share Posted March 23, 2006 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 Quote Link to comment Share on other sites More sharing options...
redbullmarky Posted March 23, 2006 Share Posted March 23, 2006 trySQL:[!--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 Link to comment Share on other sites More sharing options...
Mouse Posted March 23, 2006 Author Share Posted March 23, 2006 [!--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--]trySQL:[!--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 thanksMouse Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.