satan Posted November 23, 2008 Share Posted November 23, 2008 I'm having a hard time extracting the total number of members for this site: http://community.vitacost.com I want the number to show up next to "Active VitaSpace profiles". Can someone help me out? I'm a total beginner so if you could explain in layman's terms I'd appreciate it very much. Thanks... Link to comment https://forums.phpfreaks.com/topic/133876-extract-the-total-number-of-members/ Share on other sites More sharing options...
trampolinejoe Posted November 23, 2008 Share Posted November 23, 2008 do you have access to the database of members? If so just query the database. It would be something very simple. such as. Select COUNT(userID) from users; Link to comment https://forums.phpfreaks.com/topic/133876-extract-the-total-number-of-members/#findComment-696930 Share on other sites More sharing options...
Mchl Posted November 23, 2008 Share Posted November 23, 2008 Select COUNT(*) from users; is said to be faster actually (and gives same results) Link to comment https://forums.phpfreaks.com/topic/133876-extract-the-total-number-of-members/#findComment-696940 Share on other sites More sharing options...
trampolinejoe Posted November 23, 2008 Share Posted November 23, 2008 agreed Link to comment https://forums.phpfreaks.com/topic/133876-extract-the-total-number-of-members/#findComment-696958 Share on other sites More sharing options...
elite_prodigy Posted November 23, 2008 Share Posted November 23, 2008 Or you could do it the long way. (For variety's sake. <?php include 'php/config.php' //singular mysql DB connection file $q = "SELECT * FROM `members`"; //the query string $res = mysql_query($q,$conn); //store the result of the query on the DB $rows = mysql_num_rows($res); //count the number of rows in the result string ?> That would give you the total number of entries in the table `members`. If you wanted active members you would have to perform further operations. If you are storing validating member data in the `members` table you might want to exclude it by adding a WHERE conditional: $q = "SELECT * FROM `members` WHERE `validating` = false"; Or something similar. I would just use the above though, much quicker. mysql_num_rows() has it's uses, many of them, but this is best handled within the query it self. -David Link to comment https://forums.phpfreaks.com/topic/133876-extract-the-total-number-of-members/#findComment-696962 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.