Hi, I'm building a basic forum type thing but having a problem with getting records duplicated when people reply to a post.
This is the code I'm using to process the replies...[php]
$thread_id = $_POST["thread_id"];
$details = strip_tags($_PO ST["details"], "<b><i><u>" );
$member_id = $_POST["member_id"];
mysql_query("IN SERT INTO forumReplies (Details, MemberID, ThreadID) VALUES ('" . $details . "', '" . $member_id . "', '" . $thread_id . "')");
header('Locatio n: details.php?id= ' . $thread_id);[/php]It works, but the problem is that SOME (apparently at random), get repeated when the user hits submit, but some don't. I can't work out any reason for it. It seems that the code is being run twice on some occations.
I looked at the data in the database and it does indeed post two exact copies of the same post (with different record ID's).
I have recently updated to MySQL from an Access driven version. I also had exactly the same problem with Access (similar ASP code) but assumed that it was just crappy Access. It seems not.
Any help is really apreciated!
This is the code I'm using to process the replies...[php]
$thread_id = $_POST["thread_id"];
$details = strip_tags($_PO ST["details"], "<b><i><u>" );
$member_id = $_POST["member_id"];
mysql_query("IN SERT INTO forumReplies (Details, MemberID, ThreadID) VALUES ('" . $details . "', '" . $member_id . "', '" . $thread_id . "')");
header('Locatio n: details.php?id= ' . $thread_id);[/php]It works, but the problem is that SOME (apparently at random), get repeated when the user hits submit, but some don't. I can't work out any reason for it. It seems that the code is being run twice on some occations.
I looked at the data in the database and it does indeed post two exact copies of the same post (with different record ID's).
I have recently updated to MySQL from an Access driven version. I also had exactly the same problem with Access (similar ASP code) but assumed that it was just crappy Access. It seems not.
Any help is really apreciated!
Comment