This problem has been bugging me for some time now.
I started doing PHP about a week ago. I made a website where you can post updates using an online form, now I'm trying to make a forum. IT ALL works except for one thing, when you click on a topic, the original message doesn't display.
I'm using two tables, one for topics and one for replies:
The topics table has these fields:
ID(auto_increment), Name, Subject, Content, Date
and the replies table looks like this:
ID(auto_increment), TopicID, Name, Content, Date
The code I'm using to display the original message (I'm including the preceeding code in case I made a mistake there):
<?
$user="fbacall";
$password="********";
$database="fbacall_uk_db";
$Host = "localhost";
$link_id = mysql_connect($Host, $user, $password) or die(mysql_error());
mysql_select_db($database);
$query="SELECT * FROM `replies` WHERE `threadID`='$threadID'";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
mysql_select_db($database);
$resultx=mysql_query("SELECT * FROM `threads` WHERE `id`='$threadID'");
mysql_close();
echo "<b><center>Original Message..</center></b><br><br>";
$name2=mysql_result($resultx,$threadID,"name");
$subject2=mysql_result($resultx,$threadID,"subject");
$content2=mysql_result($resultx,$threadID,"content");
$date2=mysql_result($resultx,$threadID,"date");
print<<<E
<tr class="tr1">
<td width="15%"><i>$name2: </i></td>
<td width="55%"><i>$content2</i></td>
<td width="30%"><i>$date2</i></td>
</tr>
E;
The threadID variable is stored in the url and seems to work when only displaying the replies for this thread.
What have I done wrong?