vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   How could I display total # of subscribers? Help Please (https://vborg.vbsupport.ru/showthread.php?t=95907)

TrickyD 09-09-2005 04:01 AM

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!

TrickyD 09-12-2005 06:33 PM

Can any of you code geniuses out there help me out with this?

Andreas 09-12-2005 06:35 PM

[sql]select count(*) from subscriptionlog where status=1[/sql]

TrickyD 09-12-2005 06:52 PM

Quote:

Originally Posted by KirbyDE
[sql]select count(*) from subscriptionlog where active=1[/sql]

Kirby, thanks for the reply.

How will running that query allow me to call the value in the header template?

Andreas 09-12-2005 07:50 PM

Well, just execute it :)

global_start
PHP Code:

$subscribers $db->query_first("SELECT COUNT(*) AS totalactive FROM " TABLE_PREFIX "subscriptionlog WHERE active=1");
$subscribers['totalactive'] = vb_number_format($subscribers['totalactive']); 

As this adds 1 Query/Page, you might want to cache the Value in Datastore, but that involves more Code - and File Edits.

TrickyD 09-13-2005 06:23 PM

Quote:

Originally Posted by KirbyDE
Well, just execute it :)

global_start
PHP Code:

$subscribers $db->query_first("SELECT COUNT(*) AS totalactive FROM " TABLE_PREFIX "subscriptionlog WHERE active=1");
$subscribers['totalactive'] = vb_number_format($subscribers['totalactive']); 

As this adds 1 Query/Page, you might want to cache the Value in Datastore, but that involves more Code - and File Edits.

Kirby, thanks again for the help, but I think I'm code stupid.

I attempt to run the query but it gives me the following error

Quote:

An error occurred while attempting to execute your query. The following information was returned.
error number: 1146
error desc: Table 'trickyd_ncaa.subscriptionlog' doesn't exist
And when I create a new plugin for the global_start.php as you suggested my board gets a fatal error.

Marco van Herwaarden 09-13-2005 08:20 PM

Then you are probably using a table prefix, and will have to add that in front of tablenames.

TrickyD 09-14-2005 07:06 AM

Quote:

Originally Posted by MarcoH64
Then you are probably using a table prefix, and will have to add that in front of tablenames.

Indeed, my fault there. However when adding the prefix to the query, it returned the following error.

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?

Marco van Herwaarden 09-14-2005 09:07 AM

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:

SELECT table1.nametable2.*
FROM " . TABLE_PREFIX . "table1 AS table1
LEFT JOIN 
" . TABLE_PREFIX . "table2 AS table2 ON (table1.keyid table2.keyid


Andreas 09-14-2005 09:10 AM

My fault - it's status not active


All times are GMT. The time now is 07:27 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
  • Page Generation 0.01242 seconds
  • Memory Usage 1,743KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_php_printable
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete