Current location: Hot Scripts Forums » Programming Languages » PHP » Need a Member Counter


Need a Member Counter

Reply
  #1 (permalink)  
Old 06-30-05, 01:15 PM
checkdizguyout checkdizguyout is offline
New Member
 
Join Date: Jun 2005
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Need a Member Counter

Trying to find a script that will count the number of registered members on my site, and display it on the homepage. Any suggestions?
Reply With Quote
  #2 (permalink)  
Old 06-30-05, 01:17 PM
Vulture Vulture is offline
Newbie Coder
 
Join Date: Dec 2004
Location: Scotland, UK
Posts: 50
Thanks: 0
Thanked 0 Times in 0 Posts
How are you member details stored? If you have a table solely for member details, a simple count on that table would be all you'd need, eg
Code:
SELECT COUNT(*) FROM `table`;
Reply With Quote
  #3 (permalink)  
Old 06-30-05, 10:52 PM
checkdizguyout checkdizguyout is offline
New Member
 
Join Date: Jun 2005
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
My members are stored in an sql database... how do i use that code than to make that number viewable to people visiting the website....
Reply With Quote
  #4 (permalink)  
Old 07-01-05, 04:02 AM
Vulture Vulture is offline
Newbie Coder
 
Join Date: Dec 2004
Location: Scotland, UK
Posts: 50
Thanks: 0
Thanked 0 Times in 0 Posts
Ok, say, for example, that your members are stored in the table "users". Therefore every row in "users" is a different member. Here's how I would do it, although there are alternative methods.
PHP Code:

<?php

//db connection goes here

$query mysql_query("SELECT COUNT(*) FROM `users`");
$count mysql_fetch_array($query);

echo 
"We currently have <strong>{$count[0]}</strong> members.";

?>
One other way of doing it would be to take out the COUNT, perform a simple SELECT and use mysql_num_rows.

Hope that helps
Reply With Quote
  #5 (permalink)  
Old 07-01-05, 01:32 PM
checkdizguyout checkdizguyout is offline
New Member
 
Join Date: Jun 2005
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
thats what I was looking for, thanks alot!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
special counter Shirun Script Requests 1 06-29-05 03:32 AM
php/coding member registration/login gplol Job Offers & Assistance 1 02-15-05 07:32 PM
Counter script (to offer free counter service) basara55 Script Requests 0 06-29-04 08:48 PM
PHP counter rogue_the_one PHP 3 02-26-04 12:15 PM
member ratings Skeleton Man Hot Scripts Forum Questions, Suggestions and Feedback 7 01-22-04 09:27 PM


All times are GMT -5. The time now is 06:53 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.