Author Topic: Number of members  (Read 6827 times)

gwill23

  • Posts: 50
    • View Profile
    • http://www.residualenterprises.com
Number of members
« on: August 16, 2004, 08:28:49 am »
I would like to report the number of subscribers to my newsletter on my website.  Is there a dynamic way to get this number?  I know it appears on the user database page, but I want it to show up on the page where I sell ad space.

valuehosted

  • Posts: 40
    • View Profile
    • http://www.phpreviews.com
Number of members
« Reply #1 on: August 17, 2004, 10:23:01 pm »
That is a feature that should (!) be in the next release per my request a while back.

--Tone

DW

  • Administrator
  • Posts: 3787
    • View Profile
    • https://legacy.listmailpro.com
Number of members
« Reply #2 on: August 30, 2004, 05:22:22 am »
To do this on your web site would require some custom PHP script, as follows (example for list 1):
Code: [Select]

<?php
$link 
mysql_connect('localhost','USERNAME','PASSWORD');
mysql_select_db('DATABASE,$link);
$urows = mysql_query("select count(*) from lm_users where list = '
1'");
list($numusers)=mysql_fetch_row($urows);
echo $numusers;
?>


This code can be inserted wherever you want the counter.  Replace USERNAME, PASSWORD, and DATABASE with your ListMail MySQL access info (same as config.php).

If your pages cannot run PHP, possibly because your files are named ".html", you will need to add a file named ".htaccess" to the directory your page is in.  Since you can't create this filename in Windows, edit the file as "htaccess.txt", upload it, then rename it remotely.

The file should contain the following:
Code: [Select]
AddType application/x-httpd-php .html
Hope that helps!  :o
Dean Wiebe
ListMailPRO Author & Developer - Help | Support | Hosting

gwill23

  • Posts: 50
    • View Profile
    • http://www.residualenterprises.com
Number of members
« Reply #3 on: August 30, 2004, 08:21:28 am »
I tried it with and without a php file doing as you said and I get the following error.

Parse error: parse error in /home/opportunityone/public_html/test.php on line 11

Line 11 in my file is
$urows = mysql_query("select count(*) from lm_users where list = '1'");

gwill23

  • Posts: 50
    • View Profile
    • http://www.residualenterprises.com
Number of members
« Reply #4 on: August 30, 2004, 10:40:17 am »
I figured it out and got it working.  I had to change my .html page to a .php page.  No harder than renaming.

gwill23

  • Posts: 50
    • View Profile
    • http://www.residualenterprises.com
Number of members
« Reply #5 on: August 30, 2004, 10:54:06 am »
This works great everyone check it out.

http://www.opportunityone.net/ads.php

Incase you don't notice it is the bold line on the page.  I added a script that gets today's date too.

Very Cool thanks DM!

gwill23

  • Posts: 50
    • View Profile
    • http://www.residualenterprises.com
Number of members
« Reply #6 on: August 30, 2004, 11:00:56 am »
I changed part of the above code to make sure it only counts active members.

Quote
select count(*) from lm_users where list = '1' and cnf = '1'


So the new code looks like:

Quote
<?php
$link = mysql_connect('localhost',edited','edited');
mysql_select_db('edited',$link);
$urows = mysql_query("select count(*) from lm_users where list = '1' and cnf = '1'");
list($numusers)=mysql_fetch_row($urows);
echo $numusers;
?>



And here is the date script:

Quote
<script language="JavaScript1.2">

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
var months=new Array(13);
months[1]="January";
months[2]="February";
months[3]="March";
months[4]="April";
months[5]="May";
months[6]="June";
months[7]="July";
months[8]="August";
months[9]="September";
months[10]="October";
months[11]="November";
months[12]="December";
var time=new Date();
var lmonth=months[time.getMonth() + 1];
var date=time.getDate();
var year=time.getYear();
if (year < 2000)    // Y2K Fix, Isaac Powell
year = year + 1900; // http://onyx.idbsu.edu/~ipowell
document.write(lmonth + " ");
document.write(date + ", " + year);
// End -->
              </script>


Thanks again DM.

BGSWebDesign

  • Posts: 625
    • View Profile
    • http://www.bgswebdesign.com
Number of members
« Reply #7 on: August 30, 2004, 11:53:05 am »
Gunther,

Sounds great, but your sample page gives me 404 error,
what's the page with the code on it again?
Thanks,
-Brett
http://www.bgswebdesign.com/Contact-Us.php

*** I do custom List Mail Pro installations ***
Contact me through my website (above)

gwill23

  • Posts: 50
    • View Profile
    • http://www.residualenterprises.com
Number of members
« Reply #8 on: August 30, 2004, 11:59:24 am »