Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 01-04-2003, 08:51 PM
Gutspiller's Avatar
Gutspiller Gutspiller is offline
 
Join Date: Dec 2001
Posts: 1,046
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Help me finish these few lines of code

I have this code

PHP Code:

<?
$last24 = time() - 86400;
$threads = $DB_site->fetch_array($DB_site->query("SELECT COUNT(*) as total FROM thread WHERE lastpost > $last24 AND (forumid = '143' OR forumid = '162' OR forumid = '161' OR forumid = '163' OR forumid = '145' OR forumid = '153' OR forumid = '164' OR forumid = '155' OR forumid = '167' OR forumid = '158' OR forumid = '165' OR forumid = '166')"));
echo $threads[total];
?>
which outputs the number of threads in a few of my forums. It's used to show how much news is posted every 24 hours. Those forum ids are the ids for all my forums for news. But the output number is not only the number of threads, but REPLIES also. Since I only want it to track news and news is only in the first post of each thread, can somebody help me get it so that it doesn't count replies?

I'm also using close to the same code

PHP Code:
<?
$last24 = time() - 0;
$threads = $DB_site->fetch_array($DB_site->query("SELECT COUNT(*) as total FROM thread WHERE lastpost < $last24 AND (forumid = '143' OR forumid = '162' OR forumid = '161' OR forumid = '163' OR forumid = '145' OR forumid = '153' OR forumid = '164' OR forumid = '155' OR forumid = '167' OR forumid = '158' OR forumid = '165' OR forumid = '166' OR forumid = '127')"));
echo number_format($threads[total]);
?>
to track the total amount of news posts ever posted. On this one I don't know if it's tracking replies also or not, but if it is, I don't want it too.

Let me know if you need more info, if you care to see how I'm using it you can head to http://www.3dNewz.com and see it in the top right of the front page.

Thanks for any help you can provide.
Reply With Quote
  #2  
Old 01-04-2003, 09:31 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

hmm, it doesn't look wrong, seems everything is ok, but you should make it better readable:
also the lastpost < time() - 0 is not needed...

PHP Code:
<?
$threads = $DB_site->fetch_array($DB_site->query("SELECT COUNT(*) as total FROM thread WHERE forumid IN (143,162,161,163,145,153,164,155,167,158,165,166,127)"));
echo number_format($threads[total]);
?>

and yes, it's just counting the thread ammount, not the replies,
Reply With Quote
  #3  
Old 01-04-2003, 10:10 PM
Gutspiller's Avatar
Gutspiller Gutspiller is offline
 
Join Date: Dec 2001
Posts: 1,046
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally posted by Xenon
hmm, it doesn't look wrong, seems everything is ok, but you should make it better readable:
also the lastpost < time() - 0 is not needed...

PHP Code:
<?
$threads = $DB_site->fetch_array($DB_site->query("SELECT COUNT(*) as total FROM thread WHERE forumid IN (143,162,161,163,145,153,164,155,167,158,165,166,127)"));
echo number_format($threads[total]);
?>

and yes, it's just counting the thread ammount, not the replies,
Well I wasn't sure about the bottom code that I posted, but the first code that I posted, I know for a fact is counting the replies, because on days that I don't post news it will say 1 or a few posts and then I look at people have made replies to news posts. So I still need help with the top code on how to fix it. Thanks so far though.
Reply With Quote
  #4  
Old 01-04-2003, 10:17 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

yes, the first one would update when a new post is made instead of this:
Code:
WHERE lastpost < $last24
use
Code:
WHERE dateline < $last24
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 10:23 AM.


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.04793 seconds
  • Memory Usage 2,200KB
  • 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
  • (2)bbcode_code
  • (4)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (4)post_thanks_box
  • (4)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (4)post_thanks_postbit_info
  • (4)postbit
  • (4)postbit_onlinestatus
  • (4)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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete