![]() |
How could I display total # of subscribers? Help Please
I use the paid subscriptions feature to help cover a majority of the financial burden my forum generates and I'd like to be able to display somewhere in the header the total number of subscribers.
Basically I'd like to have just a small little space say "Current Subscribers X, Goal 120" Where X is pulled automatically like it is from the Subscriptions Manager tab in the AdminCP If anyone can help on this one I'd greatly appreciate it. Thanks! |
Can any of you code geniuses out there help me out with this?
|
[sql]select count(*) from subscriptionlog where status=1[/sql]
|
Quote:
How will running that query allow me to call the value in the header template? |
Well, just execute it :)
global_start PHP Code:
|
Quote:
I attempt to run the query but it gives me the following error Quote:
|
Then you are probably using a table prefix, and will have to add that in front of tablenames.
|
Quote:
An error occurred while attempting to execute your query. The following information was returned. error number: 1054 error desc: Unknown column 'active' in 'where clause' Any thoughts? |
What is the exact query you are running?
If you are using a table prefix, and are referencing the tablename as identifier for a columnname anywhere the SQL-statement, you should also add an AS clause. Example: PHP Code:
|
My fault - it's status not active
|
Quote:
|
Nah, that wasn't a typo - just bad (brain) memory.
I don't deal with the subscriptionlog table that often you know. |
True, but it was still classic. ;)
|
Thanks again for all the help guys, hopefully this is the last I have to bug you about this particular hack.
So I ran the query with the prefix and updated code as [sql]select count(*) from cmq_subscriptionlog where status=1[/sql] And it returned the correct number, 95. So then I entered the following in the plugin manager for the global_start PHP Code:
But when I went back to my board to check it, it displalyed ARRAY What'd I screw up this time :dead: |
Use $subscribers[totalactive] in the template.
|
Quote:
I'd like to throw out one last thank you to all. |
I know this thread is from back in 2005, but this mod is still working and has been a huge asset to my forum.
But I've grown and have added other subscriptions. Here is my question... How can I modify this code to only count the total active subscribers in a specific subscription? Code:
$subscribers = $db->query_first("SELECT COUNT(*) AS totalactive FROM " . TABLE_PREFIX . "subscriptionlog WHERE status=1"); |
Quote:
PHP Code:
|
All times are GMT. The time now is 04:49 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|