The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Accessing field in first 'post' per thread
You know how sometimes you look at a problem for so long that you begin to wonder what it is you're trying to do in the first place? Well, I'm there :ermm:
What I'm trying to do: Every thread has an associated 'first' post. Correct. I would like to access a specific field in this 'first' post, for a dynamic range of threadids, and be able to access the contents of this field. e.g. Thread with 'threadid' of '123', has a first post whose 'postid' is '456'. This post (postid=456) has a field called 'sample' which contains "ABC". I'd like to access the contents of 'sample' when I only have the 'threadid' as a reference point to start with. So 'threadid' 100 returns "ABC". What SQL statement do I need to use to get to this data? I know how to extract the first 'postid' for a thread. How do I then extract a specific field from the post? Thanks for any help. |
#2
|
||||
|
||||
How do you wanna access it ? in the postbit ?
PHP Code:
|
#3
|
||||
|
||||
[SQL]SELECT post.sample FROM thread LEFT JOIN post on thread.firstpostid = post.postid WHERE thread.threadid = $threadid[/SQL]
something like that should work, change if you have table prefixes. |
#4
|
|||
|
|||
Hi Natch,
No, I want to access it from index.php 1. I have added a field to the post table called "sample", which is written to when the FIRST post is submitted. 2. I am displaying the latest 10 threads on index.php, and I would like to display the contents of "sample" for each. Thanks, Morag. |
#6
|
|||
|
|||
Thanks Colin - that should do the trick.
Headache receding already |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|