Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 09-09-2005, 04:01 AM
TrickyD TrickyD is offline
 
Join Date: Oct 2003
Posts: 33
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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!
Reply With Quote
  #2  
Old 09-12-2005, 06:33 PM
TrickyD TrickyD is offline
 
Join Date: Oct 2003
Posts: 33
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Can any of you code geniuses out there help me out with this?
Reply With Quote
  #3  
Old 09-12-2005, 06:35 PM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

[sql]select count(*) from subscriptionlog where status=1[/sql]
Reply With Quote
  #4  
Old 09-12-2005, 06:52 PM
TrickyD TrickyD is offline
 
Join Date: Oct 2003
Posts: 33
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
  #5  
Old 09-12-2005, 07:50 PM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #6  
Old 09-13-2005, 06:23 PM
TrickyD TrickyD is offline
 
Join Date: Oct 2003
Posts: 33
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #7  
Old 09-13-2005, 08:20 PM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Then you are probably using a table prefix, and will have to add that in front of tablenames.
Reply With Quote
  #8  
Old 09-14-2005, 07:06 AM
TrickyD TrickyD is offline
 
Join Date: Oct 2003
Posts: 33
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
  #9  
Old 09-14-2005, 09:07 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #10  
Old 09-14-2005, 09:10 AM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

My fault - it's status not active
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:10 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.07948 seconds
  • Memory Usage 2,264KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (3)bbcode_php
  • (4)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete