Log in

View Full Version : how to call thread title from attachmentid


Aurous
05-03-2004, 12:08 AM
I am trying to modify this hack:

https://vborg.vbsupport.ru/showthread.php?t=64644

It displays all attachments in one page. Now what I would like to do is display the thread subject line (or Thread Title) instead of the filename.

Example: <a href="attachment.php?attachmentid=$attach[attachmentid]">Thread Title</a>

How do I call subject line from the attachmentid? .. please help.

Thanks

PS. I already asked Scrub (who released the mod) for help before posting this thread.

Xenon
05-03-2004, 04:47 PM
aw...
thats doable, and not hard as well, but you need a big join as you have to join the thread and post table, which you shouldn't do if not needed..


SELECT thread.title, attachment.attachmentid
FROM attachment
INNER JOIN post ON (attachment.postid = post.postid)
INNER JOIN thread ON (post.threadid = thread.threadid)

Aurous
05-04-2004, 12:01 AM
which you shouldn't do if not needed

why shouldnt someone use JOIN? Will that put more load on the server? :surprised:

Xenon
05-04-2004, 07:17 PM
na, you can use joins, but i said you shouldn't join the thread and post table if not really needed.

thread and post table are the biggest tables on vb you have, and therefore the join operation isn't an easy one.

As this is on a page which wouldn't be viewed too often, it would be ok, but i just made the general warning ;)