OK if I misunderstood the first time I didn't mean to be patronising. If I get you right, you're basically asking how PHP takes the variable, i.e. the ID of the post in question, and turns it into a readable username, right?
In basic terms, it would be something like this.
//first get this thread's posts
$thisThreadPosts = mysql_query("select post_text, posted_when, username from posts, users where users.user_id = posts.user_id && thread_id=[id thread being viewed]");
//post_text and posted_when are columns of the posts table, username is a column of the users table
//output posts
echo "<table>";
for ($f=0; $f<mysql_num_rows($thisThreadPosts); $f++) {
echo "<tr><td>Posted by ".mysql_result($thisThreadsPost, $f, 'username')." at ".mysql_result($thisThreadsPost, $f, 'posted_when')."</td></tr>\n<tr><td>".mysql_result($thisThreadPosts, $f, 'post_text')."</td</tr>";
}
echo "</table>";
It's the mysql query which turns the user_id stored in the posts table into a readable username.
Am I getting warm to what you're after? lol