hello, again. i have another question. i have a simple comment script i had found on the net and mad some changes to better fit my site. how when i past the code into a page the same comments show up. how do i get rid of this so that the post are not all the same here are my codes.
connect.php[code]
<?php $host = ''; $username = ''; $password = ''; $database = ''; mysql_connect($host, $username, $password) or die("Could not connect to MySQL. Please check if all the login information is correct."); mysql_select_db($database) or die("Could not find Database. Please check if the database information is correct."); ?>[/code]
Commentsystem folder addcomment.php[code]
<?php include_once("../connect.php"); function cleanText($text) { $text = str_replace("\\", "\\\\", $text); $text = str_replace("&", "&", $text); $text = str_replace("<", "<", $text); $text = str_replace(">", ">", $text); $text = str_replace("\"", """, $text); $text = str_replace(" ", " ", $text); $text = str_replace("\n", "", $text); $text = str_replace("'", "''", $text); return $text; } $msg_title = cleanText($_POST['msg_tital']); $msg_message = cleanText($_POST['msg_message']); $msg_submit = $_POST['msg_submit']; if ($msg_submit && $msg_title && $msg_message) { mysql_query ("INSERT INTO comments VALUES ('','".$msg_tital."','".$msg_message."')"); } header("location:../commentsystem/"); ?>[/code]
index.php[code]
<?php include_once ( "../connect.php"); $commenting_form = 'ADD COMMENT | |
Tital | |
message | |
" .$message. "
"; } $comments.= $commenting_form; } else { $comment = "There are no comments at this time "; } ?> Untitled Document <?php echo $comments;
?>
[/code]