vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   Auto Link Threads (https://vborg.vbsupport.ru/showthread.php?t=44713)

mADmAX` 10-18-2002 05:00 AM

Auto Link Threads
 
I am trying to do something similiar to here with the hacks / support threads. I have it all set where it will make the both of them but I am trying to get them to link.

Will try to explain. I do a form pretty much like newthread but it does it twice (so the support forums has been started) but want them to link.

If your on the support thread, it will give you the link to the file thread with the description etc.

If your on the file thread, it will give you the link to the support thread.

I have to keep them seperate as the file thread will have way more stuff in it than what I want in the main thread (support thread). I cant figure out how to do this as I have no idea what the postid will be. So what would I write for it to know this?

I will pay well if needed for this little code...

Xenon 10-18-2002 11:59 AM

Well you have to add a field to thread- table called for example linkid
then when inserting the threads, you have to fill it with the other threadid.
then you've just add a link into your showthreadtemplate which calls showthread.php?threadid=$threadinfo[linkid]..

can't help more without knowing your exact code

mADmAX` 10-18-2002 03:45 PM

Thanks...

At the time of creating the thread, I will not know the threadid as its posting it at the same time.

I think this will work however if I give both threads the same linkid and at the same time being sure that its not a linkid that I have already used.

So, how would I go about having it auto-increment and know the linkid at the same time?

NTLDR 10-18-2002 04:40 PM

Quote:

Originally posted by mADmAX`
So, how would I go about having it auto-increment and know the linkid at the same time?
MySQL will only allow you to have one field per table auto-increment, so if you were adding the linkid to the thread table then you can use that method ;)

mADmAX` 10-18-2002 06:19 PM

Hmmm, so how would I go about doing this? Create a new table and have it autoincrement and connect to threadid somehow?

I also wouldnt want it to increment unless its told to (like when I create both threads). That way, the only ones that have linkid's are the ones that have two threads.

Xenon 10-18-2002 11:47 PM

no just add the linkidtable as i told ya

then in your script you find for example this parts..:
PHP Code:

//insert thread 1
$DB_site->query("INSERT INTO thread ...."); 
//insert thread 2
$DB_site->query("INSERT INTO thread ...."); 

you have to add one query and change the things a bit:
PHP Code:

//insert thread 1
$DB_site->query("INSERT INTO thread ...."); 
$thread1id=$DB_site->insert_id();
//insert thread 2 (add linkid and $thread1id as value
$DB_site->query("INSERT INTO thread ...."); 
$thread2id=$DB_site->insert_id();
$DB_site->query("UPDATE thread SET linkid=$thread2id WHERE threadid=$thread1id"); 



All times are GMT. The time now is 11:17 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.01190 seconds
  • Memory Usage 1,729KB
  • 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)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)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