I am trying to make another forum (I have made about 3 in the past all successful) and I am trying to make this one a lot easier to edit etc. I am having problems with SQL Query in the page that displays the thread. With this page, I use two tables, one is the table that has the thread starting post (new_forum_thread) and a table with all the replies to that thread starter (new_forum_replies). My current sql query is...
$sql2 = mysql_query("SELECT *
FROM new_forum_thread, new_forum_replies
WHERE new_forum_thread.threadid = '1516' AND new_forum_replies.threadid = '1516'
ORDER BY new_forum_thread.posttime, new_forum_thread.replytime") or die(mysql_error());
The query is supposed to select everything from the thread stater row where the thread ID is 1516 and then select all from the thread replies where the ID is 1516. After it does that it is supposed to display in in the order of, first the thread starter and then the replies in the order they where repled it. I am currently making a test page to test the sql query to make sure it works. Anyways, my problem is that in that sql query, everything works except, including displaying the replies in the right order, but it does not display the thread starter. just the replies. My code for the page is...
include_once("$DOCUMENT_ROOT/common.php");
$sql2 = mysql_query("SELECT *
FROM new_forum_thread, new_forum_replies
WHERE new_forum_thread.threadid = '1516' AND new_forum_replies.threadid = '1516'
ORDER BY new_forum_thread.posttime, new_forum_thread.replytime") or die(mysql_error());
while ($sql = mysql_fetch_object($sql2)) {
echo $sql->message . "<br>";
}
I made sure everything is spelled correctly and it still does not display the thread starter. Thank you in advance.