vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Member Archives (https://vborg.vbsupport.ru/forumdisplay.php?f=202)
-   -   trouble with forumdisplay.php (https://vborg.vbsupport.ru/showthread.php?t=44882)

Chris M 10-23-2002 10:08 PM

How would I make a Query to pull just the ReplyCount, The Thread Title, and then link it to the thread id?

Ive tried loads of queries, but i cant get it to work...

Could those queries be adapted?

If so, would you mind telling how?

Satan

NTLDR 10-23-2002 10:35 PM

PHP Code:

$threadquery=$DB_site->query("SELECT threadid,title,replycount FROM thread"); 

Then use $threadquery[threadid] for the threadid. The above query will return the values for all threads.

Chris M 10-23-2002 10:37 PM

Cool thanks:)

You wouldnt happen to know how I could get that to display in a table would you?

Satan

NTLDR 10-23-2002 10:42 PM

Basicly have this PHP and then two templates, the bit, for each result and the mainone to house them all:

PHP Code:

$threadquery=$DB_site->query("SELECT threadid,title,replycount FROM thread");
while (
$threadinfo $DB_site->fetch_array($threadquery)) {

        
$title unhtmlspecialchars($threadinfo['title']);
        
$replycount $threadinfo['replycount'];
        
$threadid $threadinfo['threadid'];
        eval(
"\$threadbits .= \"".gettemplate('query_bit')."\";");
    }
eval(
"\$threads = \"".gettemplate('query')."\";"); 

Change query_bit and query in the eval statements to your template names ;)

Chris M 10-23-2002 10:47 PM

Thanks:)

Satan

jsell 10-23-2002 11:08 PM

it doesn't work right i'm sure i'm doing something wrong

here is what i changed the $threads Query to

PHP Code:

$threads=$DB_site->query("
SELECT 
$dotuserid $votequery ".iif($foruminfo[allowicons],'icon.title as icontitle,icon.iconpath,','')."
    thread.threadid,thread.title,lastpost, forumid,pollid,open,replycount,postusername,postuserid,
    lastposter,thread.dateline,views,thread.iconid,notes,thread.visible,sticky,votetotal,attach,reqdata.threadid,reqdata.filler AS reqfiller
    FROM thread
    LEFT JOIN reqdata USING (threadid)
    "
.iif($foruminfo[allowicons],'LEFT JOIN icon ON (icon.iconid = thread.iconid)','')."
    
$dotjoin
    WHERE 
$threadids
    ORDER BY sticky DESC, 
$sortfield $sqlsortorder
    "
); 

then below inside the while loop

PHP Code:

while ($thread=$DB_site->fetch_array($threads)) { // and $counter++<$perpage) { 

i put

PHP Code:

 //request hack
   
if ($threads[reqfiller]!='') {
       eval(
"\$filledby = \"".gettemplate('filledby')."\";");
   } else {
       
$filledby='';
      }
   
//request hack 

but it doesn't assign a value to the variable $threads[reqfiller]

any idea

Thanks

--jsell

Chris M 10-23-2002 11:13 PM

Thats because it would be :

PHP Code:

//request hack
   
if ($thread[reqfiller]!='') {
       eval(
"\$filledby = \"".gettemplate('filledby')."\";");
   } else {
       
$filledby='';
      }
   
//request hack 

You assigned the variable $thread to fetch the array of $threads, so you use $thread not $threads;)

Try that code, and $thread[reqfiller];)

Satan

jsell 10-23-2002 11:17 PM

Thanks i think my brain is fried

--jsell

Erwin 10-24-2002 04:41 AM

LOL! I see that you're getting support from the pros here. :) Sorry I didn't get back to this thread sooner, but it looks like things are under control.

Xenon 10-24-2002 09:03 AM

:)
you're welcome jsell

@Erwin: That thread is a good example:
So sees a problem and many users jump to it and try to solve ;)


All times are GMT. The time now is 03:34 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.01154 seconds
  • Memory Usage 1,751KB
  • 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
  • (6)bbcode_php_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