users in total

Questions about phpList features (the answer is probably 'Yes!')
Forum rules
Please help the volunteers to help you by supplying the version of phpList you are using, browser & version and if possible, a link to your phpList installation. This is for Version 2 of phpList (the orange one).

users in total

Postby mobilenetsolution » 10:38am, Sun 09 Feb, 2014

Hi, quick Question

PHPList Version 2.10.13
I want to show the users in total on my Front Page as Info for my Visitors.
How can i do this?

Thanks for any help
phpList newbie
Posts: 2
Joined: 10:32am, Sun 09 Feb, 2014

Re: users in total

Postby Dragonrider » 11:11am, Sun 09 Feb, 2014

You'll need to add a mixture of php and mysql to get this to work.

The following code should work on version 2 and 3 without any amendments.

The only change you would need to do is change phplist in line 4 to match your installation directory.

Other than that, the code accesses your config.php file, obtains the database settings, then does a count on the _user_user table which is where the number of users are stored, and displays the same.
Code: Select all

//  Get database settings from config.php file
require_once dirname(__FILE__) .'/phplist/config/config.php';
$con = mysql_connect($database_host ,$database_user,$database_password);

// Check that settings correct and can connect to database
if (!$con) {
  die('Could not connect: ' . mysql_error());

mysql_select_db($database_name, $con);

// Access phplist_user_user table or whatever table prefix you set in config file
$table = $table_prefix."user_user";
$result = mysql_query("select count(1) FROM $table");
$row = mysql_fetch_array($result);

$total = $row[0];

//Display count of users
echo "Total users: " . $total;

//Exit database tidily


It can be used in pretty much any webpage and all anyone can see, if they look at the source code of the page, is the result Total users: ###

Hope that helps.
My sites:-,,,
Latest phpList version is now 3.0.12 (3 February 2015) and requires a minimum of MySQL 5.0 and PHP 5.3.x
Posts: 3460
Joined: 6:58am, Sun 02 Jul, 2006
Location: Ilkley, West Yorkshire, United Kingdom

Re: users in total

Postby mobilenetsolution » 7:37pm, Sun 09 Feb, 2014

Thanks a lot, was helping me absolut fine, much appreciated
phpList newbie
Posts: 2
Joined: 10:32am, Sun 09 Feb, 2014

Return to Does phpList do this?

Who is online

Users browsing this forum: No registered users and 2 guests