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 05-09-2005, 07:48 PM
Fuzz Fuzz is offline
 
Join Date: Jan 2002
Posts: 13
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Thread Reply Count on NONvb page

Hey all,

I have searched and searched these forums for a solution to no avail. Hopefully someone can help me. I don't think it is a hard mod and I feel like I'm close because I know PHP to a small extent.

I just want to post the reply count of a desingated thread. For instance, I would have a news story on my front page and then have a simple phrase at the bottom that would link the user to that news article (thread xxxx) on the forums and then also show a reply count. So is there an easy way to do this? something like this:

$replycount = "SELECT replycount FROM thread WHERE threadid = 715925";

Obviously, I know the above statement is wrong, but it gives a better clarification on what I need. Any help would be much appreciated. Thanks in advance.

(I'm running VB 3.0.7)

steve
Reply With Quote
  #2  
Old 05-10-2005, 08:46 PM
Fuzz Fuzz is offline
 
Join Date: Jan 2002
Posts: 13
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I have been playing with this for hours now, still not luck. Can anyone please give me a knock in the right direction. This is the code I'm using now, but I"m still getting nothing to display. Please help


Code:
require_once("./global.php"); 

$threadWanted = 715925;
$replies = $DB_site->query_first("SELECT replycount FROM " . TABLE_PREFIX . "thread WHERE threadid = " . intval($threadWanted));

echo "$replies['replycount']";
Reply With Quote
  #3  
Old 05-11-2005, 12:04 AM
cinq's Avatar
cinq cinq is offline
 
Join Date: Oct 2002
Posts: 1,398
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

PHP Code:
require_once("./global.php"); 
$replies $DB_site->query_first("SELECT replycount FROM " TABLE_PREFIX "thread WHERE threadid = 715925 ");
echo 
$replies['replycount']; 
?
Reply With Quote
  #4  
Old 05-11-2005, 12:38 AM
Fuzz Fuzz is offline
 
Join Date: Jan 2002
Posts: 13
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for the reply Cing -

Unfortunately, I tried your code and I'm still getting nothing. I just recieve a blank page, no errors, just a blank page.

I'm still playing around with the code. It seems so easy, but it remains so hard. If you get any alternative ideas, please share them. I'm still in a rut. \=(
Reply With Quote
  #5  
Old 05-11-2005, 12:44 AM
cinq's Avatar
cinq cinq is offline
 
Join Date: Oct 2002
Posts: 1,398
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What does running this

Code:
SELECT replycount FROM thread WHERE threadid = 715925
in phpMyAdmin give you ?
Reply With Quote
  #6  
Old 05-11-2005, 01:50 AM
Link14716's Avatar
Link14716 Link14716 is offline
 
Join Date: Jun 2002
Location: Georgia, USA
Posts: 2,519
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Fuzz
I have been playing with this for hours now, still not luck. Can anyone please give me a knock in the right direction. This is the code I'm using now, but I"m still getting nothing to display. Please help


Code:
require_once("./global.php"); 

$threadWanted = 715925;
$replies = $DB_site->query_first("SELECT replycount FROM " . TABLE_PREFIX . "thread WHERE threadid = " . intval($threadWanted));

echo "$replies['replycount']";
You'll get a parse error on this code:

PHP Code:
echo "$replies['replycount']"
Use either this:
PHP Code:
echo "$replies[replycount]"
or this (prefered):
PHP Code:
echo $replies['replycount']; 
Reply With Quote
  #7  
Old 05-11-2005, 05:42 AM
Fuzz Fuzz is offline
 
Join Date: Jan 2002
Posts: 13
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks again for the quick replies, much appreciated...

Quote:
Originally Posted by cinq
What does running this

Code:
SELECT replycount FROM thread WHERE threadid = 715925
in phpMyAdmin give you ?
It executed, but I didn't get a # result... this is what is spit out...

Code:
Your SQL-query has been executed successfully (Query took 0.0002 sec)
SQL-query: 
SELECT replycount
FROM thread
WHERE threadid =715925
LIMIT 0 , 30
So I'm guessing that is why I am getting a blank page still when I run my above script on a .php file... b/c no actual number is being outputted... I'm sure there is just a missing variable I'm forgetting to include.


Link - Thanks for the reply. Unfortunately I tried your corrections and still get a blank page. Not sure what the problem is but thanks for the effort. I'm not getting any parse errors or anything, just a blank page.
Reply With Quote
  #8  
Old 05-11-2005, 05:44 AM
cinq's Avatar
cinq cinq is offline
 
Join Date: Oct 2002
Posts: 1,398
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

There you go, the sql query returned 0 results in the first place, which is why echo $replies['replycount']; gives you nothing.

Are you sure there is a thread with threadid 715925 present ? Seems like an awefully large number, you must have a huge board

[edit] : ok checked your site ( assuming this is the site you are using the code for ).
Seems this thread id is not valid, could have been a deleted thread :
http://www.thefinalfantasy.com/forum...d.php?t=715925
Reply With Quote
  #9  
Old 05-11-2005, 08:45 AM
Fuzz Fuzz is offline
 
Join Date: Jan 2002
Posts: 13
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by cinq
There you go, the sql query returned 0 results in the first place, which is why echo $replies['replycount']; gives you nothing.

Are you sure there is a thread with threadid 715925 present ? Seems like an awefully large number, you must have a huge board

[edit] : ok checked your site ( assuming this is the site you are using the code for ).
Seems this thread id is not valid, could have been a deleted thread :
http://www.thefinalfantasy.com/forum...d.php?t=715925

For some reason if you change that .php?t to a .php?p, the URL will work... odd, but hey, the SQL query still wont work even if I try threadid that i KNOW exist. One interesting I just found was when I went to EXPLAIN query, I got this message:

Impossible WHERE noticed after reading const table...

Maybe we are declaring the const. table wrong, it makes no sense though... everything appears to be fine in the query. ugh

Thanks again for your ongoing help man, I feel like I"m getting real close to a solution
Reply With Quote
  #10  
Old 05-12-2005, 04:49 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Just 1 advice, try your query first in phpMySQL and when it works like expected, copy it to your script.
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 12:38 AM.


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.04070 seconds
  • Memory Usage 2,263KB
  • Queries Executed 11 (?)
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
  • (5)bbcode_code
  • (4)bbcode_php
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (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_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