Heres the code:
Code: Select all
<?php
//this part gets the entry someone is commenting on
include('config.inc.php');
$id = $_GET['p'];
mysql_connect($dblocal, $dbuser, $dbpassword);
mysql_select_db($database);
$query = "Select * From rr_posts WHERE id='$id'";
$result1 = mysql_query($query);
$post = mysql_fetch_array($result1);
echo '<font color="';
echo $datec;
echo '"';
echo 'size="4.5" face="';
echo $datef;
echo '">';
echo '<strong>';
echo $post['date'];
echo '</strong></font> <br>';
echo '<hr align="center" noshade>';
echo '<font color="';
echo $titlec;
echo '"';
echo 'face="';
echo $titlef;
echo '">';
echo $post['title'];
echo '</font><br><em><font color="';
echo $catc;
echo '"';
echo 'size="2" face="';
echo $catf;
echo '">';
echo 'Catagory:';
echo '<a href="http://www.robsreport.com/index.php?cat=';
echo $post['cat'];
echo '">';
echo $post['cat'];
echo '</a>';
echo '</font></em><br><br><font color="';
echo $contentc;
echo '"';
echo 'face="';
echo $contentf;
echo '">';
echo $post['content'];
echo '</font>';
echo '<br>';
echo '<br>';
?>
<font size="4" face="Batang"><strong>Comments:</strong></font>
<hr align="center" size="1" noshade>
<?php
//this is where the comments show up and get posted
$query2 = "Select * From rr_comments WHERE post_id='$id'";
$result2 = mysql_query($query2);
$r2ar = mysql_num_rows($result2);
if($r2ar == 0) {
echo 'No comments yet.';
}
else {
$i = 0;
while ($i < $r2ar) {
$author = mysql_result($result2, $i, 'author');
$email = mysql_result($result2, $i, 'email');
$homepage = mysql_result($result2, $i, 'homepage');
$comment = mysql_result($result2, $i, 'comment');
echo $comment;
echo '<br>';
echo'<font face="Georgia, Times New Roman, Times, serif" size=2><em>Posted by:';
echo '<a href="';
echo $homepage;
echo '">';
echo $author;
echo '</a>';
echo '</font></em>';
echo '<br>';
$i ++;
}
}
if(isset($_POST['commentgo'])) {
$name = $_POST['name'];
$email = $_POST['email'];
$homepage = $_POST['homepage'];
$comment = $_POST['comment'];
$query3 = "INSERT INTO rr_comments VALUES ('','$id','$name','$email','$homepage','$comment')";
$result3 = mysql_query($query3);
}
?>