I seem to end up having a lot of conversations like this with Kitsu... they always go like this, and usually end with me unsure how I helped him without knowing to code programs, and him saying that he can't get a clear picture of the problem without me.

What psychological functions do you see at work here? I think this could be an interesting analysis of thought processes...

athenian200: I figured out what's wrong with the links... the actual thread ids are different
athenian200: For one of the posts, it's really 417, but it's trying to link to 1046,
athenian200: Otherwise the link is formatted perfectly.
Kitsu:Problem is it's getting the ids from POSTS, not threads.
Kitsu:So that's the post id, not the threadid.
athenian200:Oh. How do you tell it to get the threadid instead of the postid?
Kitsu:That's what I researching, I'm thinking I'll need to select from two different tables, and then someone get the title via the thread id of the other.
athenian200: I can get the title of the thread for you, if you tell me what to reference it against.
athenian200: I can go into phpmyadmin and look it up, I guess.
athenian200: If both of us are in there at once, we can look at both tables at the same time.
athenian200: If there's some reason that's needed.
Kitsu:The tables are "post" and "thread", under _vb.
athenian200: Right, I thought so.
athenian200: There's a post in table "Post" with a postid of 40. Correlates to threadid 10. Matches up in table "Thread" revealing the title to be "Computer Spec Thread."
athenian200: I didn't know which one you wanted me to get.
athenian200: So I just picked one at random.
athenian200: But that's an example of what you need me to do, right?
athenian200: You give me an id of some kind, and then I tell you what's in the table?
Kitsu:Well that's what the computer needs to do.
athenian200: Oh.
Kitsu:I need to write some code that will match them up.
athenian200:[Today 02:21:48] Kitsu: That's what I researching, I'm thinking I'll need to select from two different tables, and then someone get the title via the thread id of the other.
Kitsu:Oh wow I typed "someone" instead of "somehow".
athenian200: Yeah, so I interpreted your sentence as meaning that I should go into the database and do that.
athenian200: You'd give me a threadid, and then I'd look it up in the table or something.
athenian200: Wasn't sure what was going on, thought maybe the data was dynamic and you needed one person on each table or something, and the computer wasn't fetching it right.
athenian200: And I figured it was static, so was a bit unsure what to do with that.
athenian200: But just thought, "Well, that's not hard, I can look up those tables."
athenian200: If you can get the computer to do that for me, though, I'd appreciate it. It took me about 10 seconds to look it up, and another 10 seconds to serve the answer. I think the computer could speed that up.
athenian200: xD
athenian200: If I do this enough times, though, I might be able to cut that time in half and do the whole thing in 10 seconds.
Kitsu:Haha, yeah.
athenian200: At least I proved that I understand how the tables work.
athenian200: Doing something like that kind of reminded me of DOS.
athenian200: When the computers weren't really smart enough to find stuff unless you told it exactly where to look.
athenian200: And most of the settings had to be memorized, etc.
Kitsu:Writing SQL is extremely literal.
Kitsu:You have to say EXACTLY what you want,.
Kitsu:With almost no abstraction.
athenian200: And THEN programs could find the sound card... usually.
athenian200: I'm pretty good at being literal, I think.
athenian200: xD
Kitsu:'(SELECT pagetext, postid, username, threadid, title FROM {post}) UNION ALL (SELECT title, NULL, NULL, NULL, NULL FROM {thread})'
athenian200: That looks like it would execute multiple commands at once, in a particular order with particular data.
Kitsu:Yeah, it's selecting data from two different tables at once.
athenian200: Obviously the computer wins at executing multiple database queries at high speed.
athenian200: It would take two of us to get even close.
athenian200: Looking at the tables manually.
athenian200: Yeah?
Kitsu:Trying to work it out in my head.
Kitsu:How to get the title.
Kitsu:I know I need to use the data from the post table, and somehow use it to fetch from the thread table...
Kitsu:maybe matching up ids or something.
athenian200: Why not just store the threadid from the post table somewhere temporarily, and then feed it to a query from thread table?
athenian200: Maybe in a variable or something... if you can use PHP. If it's just raw SQL, maybe that won't work.
Kitsu:I'm writing this in PHP & MySQL.
athenian200: So, what's the difficult part?
athenian200: Bridging the queries and keeping the data from being used before it's ready?
athenian200: Or is the issue with not being sure you can reliably reuse the variable several times on the same script?
Kitsu:I just can't figure out how to go about it.
Kitsu:Because I don't think I have a clear enough picture of the problem.
athenian200: Well, let's break it down. You know how to get the threadid from the postid, right?
athenian200: The program is already doing that.
Kitsu:That's the exact problem, actually.
Kitsu:I know how to get them individually.
Kitsu:But not the postid..... to the threadid, and thus the title.
athenian200: Well, first get the threadid.
athenian200: Then store it in a variable or something.
athenian200: And then call that variable again.
athenian200: When requesting data from the other table.
athenian200: Because it's the same value in each one.
athenian200: And then, print that as your final answer.
athenian200: That's basically what I did earlier, when you said you needed someone to do it.
athenian200: I just did it myself because I was getting the impression that the software couldn't due to some issue.
athenian200: LOL.
athenian200: But if it didn't work that way, I couldn't have gotten the data from the other table.
athenian200: Because there would be nothing consistent to reference.
athenian200: The fact that the values match up is the key to making the database usable for either me, or the computer.
athenian200: Neither one of us could use it if they didn't.
athenian200: I looked at the postid, glanced over to the threadid column. Wrote that down.
athenian200: Then went to the thread table.
athenian200: And looked for the threadid.
athenian200: And then glanced at the title column.
athenian200: And gave you the result.
Kitsu:It worked!!!
athenian200: Yay!
athenian200: I think part of your issue with pointers may have been that you're used to thinking of variables the way they are in Math.
athenian200: And not the way they're used in programming.
athenian200: Which tends to be really dynamic, the same information often being used in different ways to solve multiple problems.
Kitsu:Hmm, just ONE more thing.
Kitsu:Need to convert the titles to the url slugs.
Kitsu:So that Official Suggestions Thread becomes Official-Suggestions-Thread
Kitsu:I remember doing it once with codeigniter
athenian200: I think there's some kind of character replacement thing.
athenian200: That just converts certain parts of a string to another character, if it contains that character.
athenian200: Web browsers do it all the time.
Kitsu:Fully working!
Kitsu:Try it!
athenian200: Yes, it does work.
athenian200: This is pretty good.
athenian200: How did you end up doing the url slug thing?
Kitsu:Simple regular expression.
athenian200: Ah, those are the character replacement things, right?
Kitsu:$title = preg_replace('/[ ,]+/', '-', trim($miracles->title));
athenian200: Yeah, that's the exact kind of function I was thinking of.
athenian200: Just didn't know what it was called.
athenian200: But I knew there had to be something that worked that way.
Kitsu:Thanks for figuring that out though, really helped.
athenian200: I don't know how I really help, I don't know any code.
athenian200: I just have these vague ideas about how computer programs and their functions work.
athenian200: And looked them up enough to know the vocabulary.
athenian200: It's kind of cool, though.
athenian200: I wonder how you actually write these things?
athenian200: Without having that in mind.
Kitsu:It's mainly that I can't put together a clear picture of the problem very well.
Kitsu:Once you put it like you did, I immediately knew what code to write and how to structure it.
athenian200: Ahh.
athenian200: You really have studied a lot of the PHP reference, haven't you?
athenian200: It's strange what you did learn and what you didn't.
athenian200: I wouldn't be able to understand what I was reading if I didn't have these concepts in mind first.