Display number of members

Register an Account
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 01-20-2007, 09:58 PM
Pligg Donor/Designer
 
Join Date: Jan 2006
Posts: 103
Just a simple bit of code i wrote for my pligg

PHP Code:
// Number of members code start

We have:
<?php
// Query the database and get the count
$result mysql_query("SELECT * FROM users");
$num_rows mysql_num_rows($result);
// Display the results
echo $num_rows;
?>
&nbsp;members</a>

// Number of members code end
Just drop this code whenever you want it in your template.

I will however add an extra sql query so if you have a very busy pligg this might not be a good idea.
Reply With Quote
  #2 (permalink)  
Old 01-20-2007, 10:32 PM
Pligg Developer/Admin
Pligg Version: 0
Pligg Template: none
 
Join Date: Jun 2006
Location: Muncie, Indiana
Posts: 3,215
there is already a stats mod included in Pligg. You can find it in the modules manager.
Reply With Quote
  #3 (permalink)  
Old 01-21-2007, 05:55 AM
savant's Avatar
Constant Pligger
 
Join Date: Apr 2006
Location: UK
Posts: 1,181
if you are using that code, you can make it a bit more optimized by saying select id from users. that way mysql doesn't have to send all the information.

Quote:
Originally Posted by mightyb View Post
Just a simple bit of code i wrote for my pligg

PHP Code:
// Number of members code start

We have:
<?php
// Query the database and get the count
$result mysql_query("SELECT * FROM users");
$num_rows mysql_num_rows($result);
// Display the results
echo $num_rows;
?>
&nbsp;members</a>

// Number of members code end
Just drop this code whenever you want it in your template.

I will however add an extra sql query so if you have a very busy pligg this might not be a good idea.
Reply With Quote
  #4 (permalink)  
Old 01-21-2007, 10:51 AM
Pligg Donor/Designer
 
Join Date: Jan 2006
Posts: 103
Ah well, i'm not really a coder. Just trying to help.
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to change/configure the voting feature so it would only count and display number gskyjr Questions and Comments 15 09-13-2009 09:15 PM
Displaying number of members Geoserv Questions and Comments 3 01-22-2008 12:08 PM
How to display number of users in header? katlis Questions and Comments 1 01-21-2008 12:21 PM
Story Display on other sites Simon Questions and Comments 32 09-25-2007 08:33 PM
Display number of posts submitted today gragland Questions and Comments 0 12-11-2006 11:34 AM


Pligg Modules and Pligg Templates from Pligg Pro Find support on the Pligg CMS Forum - 24 hours a day! Make a donation to support Pligg CMS development