Calculating Number of subscribers in PHPList

Discussion in 'Databases' started by komirad, Aug 30, 2007.

  1. #1
    I want to query the number of subscribers to show it on one my my webpages

    Here is what it looks like:
    CREATE TABLE `phplist_listuser` (
      `userid` int(11) NOT NULL default '0',
      `listid` int(11) NOT NULL default '0',
      `entered` datetime default NULL,
      `modified` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
      PRIMARY KEY  (`userid`,`listid`),
      KEY `userenteredidx` (`userid`,`entered`),
      KEY `userlistenteredidx` (`userid`,`listid`,`entered`)
    ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
    Code (markup):
    I believe I need to do something like this:
    SELECT userid FROM phplist_listuser
    WHERE listid=2
    Code (markup):
    but I forgot how to calculate the number of results returned so I can get the number of subscribers, or is there a more efficient way of doing so?

    THANKS :D


    **UPDATE**

    After looking a the code of phplist i found this:
    $count = Sql_Fetch_Row_Query("select count(*) from {$tables['listuser']} where listid = {$row["id"]} ");
    Code (markup):
    I guess that would work, but is it efficient?
     
    komirad, Aug 30, 2007 IP