vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Need to Chose a Threadid at start of file. (https://vborg.vbsupport.ru/showthread.php?t=74218)

Michael Morris 01-11-2005 10:24 PM

Need to Chose a Threadid at start of file.
 
I'm working on a hack and I trying to add a feature that will allow users to call up threads from a certain thread by their name. To do this I need to recall the threadid.

Now, the $featsname variable by this point in the code has been ran through the globalize function lest hackers get any ideas. Here's de code..

// Determine our thread id by feat name.

PHP Code:

// Determine our thread id by feat name.
if (!empty($featname))
{
    
// We are searching by name rather than thread id.  We'll check permissions later,
    // for now just query up the first occurance of the featname.
    
$threadcache query_first("
            SELECT threadid
            FROM " 
TABLE_PREFIX "feats
            LEFT JOIN " 
TABLE_PREFIX "thread AS thread ON(thread.threadid = feats.threadid)
            WHERE thread.title = '" 
addslashes($featname) . "'
            "
);
    
    
$threadid $threadcache['threadid'];


But this doesn't fetch the thread. What do I need to do?

EDIT: Just to be clear, my feats table has threadid as a foreign key so that it can be joined to the thread table. I presume that joining the thread table to it will drop the rows that don't occur on both tables.

Michael Morris 01-11-2005 10:38 PM

Nevermind, found my problem - needed to call the function fetch_threadinfo. For the curious, final code:

PHP Code:

// Determine our thread id by feat name.
if (!empty($featname))
{
    
// We are searching by name rather than thread id.  We'll check permissions later,
    // for now just query up the first occurance of the featname.
    
$featthread $DB_site->query_first("
            SELECT feats.threadid AS threadid
            FROM " 
TABLE_PREFIX "feats
            LEFT JOIN " 
TABLE_PREFIX "thread AS thread ON(thread.threadid = feats.threadid)
            WHERE thread.title = '" 
addslashes($featname) . "'
            "
);
    
$threadid $featthread['threadid'];
    
    
// Fetch it
    
fetch_threadinfo(&$threadid);




All times are GMT. The time now is 11:16 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.00948 seconds
  • Memory Usage 1,719KB
  • 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
  • (2)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (2)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete