I am attempting to make a forum using PHP and mySQL.
At the moment it is working - you can add posts properly.
However I want the name of the poster to become a link to a page with info about them, and would like to reference the users by ID, rather than name if possible.
I loop through the posts with a while statement:
Code:
while ($myrow = mysql_fetch_array( $threadresult ))
{
printf("<tr><td>%s</td><td>Posted by: <a href=\"users.php?id=%s\">%s</a></td></tr><tr><td colspan=\"2\">%s</td></tr>\n", $myrow["post_no"], $myrow["id"], $myrow["message"]);
}
I have the sql like this:
SELECT * FROM forum,users WHERE forum.threadid=$threadid ORDER BY post_no
so that results are taken from the users and forum tables.
When I come to view the threads though, it seems that each entry is shown twice and the id for each person is 1 in the first post and 2 in the second post.
Whats wrong?
Is this possible? or should I just use the name of the poster?
"Reality is an illusion caused by alcohol deficiency"