And I have the making threads down. In fact, you yourself can make a topic, but that's not the thing at hand. I need to know how to make replies to these topics. I looked at other forums and found they have the thread ID in their link, so I did that. Other than that, I can add replies to the database, but have really no idea on how to print them out on a thread, or correlate that comment with the thread. phpmyadmin is really screwing with my head here.
index.php: (The part you need to know)
<?
$query = "SELECT * FROM posts";
$results = mysql_query($query);
while ($row = mysql_fetch_array($results)) {
echo "<font size='3'>Poster: <strong>Anonymous </strong> ID:(". $row['id'] .")</font>
<a href='reply.php?id=" . $row['id'] . "'>[REPLY]</a>
<br />";
echo "<div class='wrap'><p>" . $row['body'] . "<p></div><br />";
}
?>
Code that adds comments as a record in the database:
<?php
require('includes/connect.php');
$comment = $_POST['comment'];
if(empty($comment)) {
echo "No body supplied. Go <a href='index.php'>back</a>?";
}
else {
$query = "INSERT INTO comments (comment) VALUES ('$comment')";
mysql_query($query);
echo "<h1><center>Success! Go <a href='index.php'>back</a>?</center></h1>";
}
?>
Tables in phpmyadmin:
name: comments
fields: comment_id, comment
name: posts
fields: id, body

New Topic/Question
Reply




MultiQuote











|