Hello, i've a forum and i want it to display the topic and it's replies on one page. http://www.roelt.nl/phpengine/Freakz/ i made it display a replie but it displays only the newest. And i want it to display all the replies with the newest on the bottom of the page.
Here is my code:
Here is my code:
PHP Code:
<?php
/* Maak connection */
$db = mysql_connect("localhost", "username", "password");
mysql_select_db("database");
/* Read the message */
$sql = "SELECT id, naam, titel, inhoud FROM forum WHERE id='$id'";
$result = mysql_query($sql) or die(mysql_error());
if (mysql_num_rows($result) == 0) {
echo "<p>\n";
}
else { // Schrijf alle berichten
$row = mysql_fetch_object($result);
echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"1\" width=\"600\">\n";
echo "<tr style=\"background-color: #999999; color: White; font-weight: Bold;\">\n";
echo "\t<td width=\"20%\">Title</td>\n";
echo "\t<td width=\"80%\">$row->titel</td>\n";
echo "</tr>\n<tr>\n";
echo "<td>Name:</td>\n";
echo "<td>$row->naam</td>\n";
echo "</tr>\n<tr>\n";
echo "<td>Content:</td>\n";
echo "<td>$row->inhoud</td>\n";
echo "</tr>\n";
echo "</table><p>\n";
echo "<a href='bericht.php?replyto=$id'>Reply</a>";
}
?>
<?php
/* Maak connection */
$db = mysql_connect("localhost", "user", "pass");
mysql_select_db("db");
/* Read the message */
$sql = "SELECT id, naam, titel, replyto, inhoud FROM forum WHERE replyto='$id'";
$result = mysql_query($sql) or die(mysql_error());
if (mysql_num_rows($result) == 0) {
echo "Oops... this post doesn't exist ;(<p>\n";
}
else { // Write messages
$row = mysql_fetch_object($result);
echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"1\" width=\"600\">\n";
echo "<tr style=\"background-color: #999999; color: White; font-weight: Bold;\">\n";
echo "\t<td width=\"20%\">Title</td>\n";
echo "\t<td width=\"80%\">$row->titel</td>\n";
echo "</tr>\n<tr>\n";
echo "<td>Name:</td>\n";
echo "<td>$row->naam</td>\n";
echo "</tr>\n<tr>\n";
echo "<td>Content:</td>\n";
echo "<td>$row->inhoud</td>\n";
echo "</tr>\n";
echo "</table><p>\n";
echo "<a href='bericht.php?replyto=$id'>Reply</a>";
}
?>
Comment