Code not incrementing
Posted: Wed Sep 01, 2004 1:58 pm
I am making a forum (basic one
) and at the moment, I am trying to make the replies total increment when someone replies. When they reply, they get taken to a new page where it adds all of the data into a MySQL database, and then updates everything (last post, from whom etc). However, whenever I try and make the replies, and the views increment, They either seem to stay on 1, or stop on 2. I was wondering whether anyone had any idea why this might be hapening.
The code I am using is below, I have tried many ways, even all with no avail :\
Thanks
The code I am using is below, I have tried many ways, even
Code: Select all
replies = '$replies+1'Code: Select all
<?PHP
ob_start();
$conn = mysql_connect('localhost', 'username', 'password');
$rs = mysql_select_db('forum', $conn);
$sql2 = "SELECT * FROM threads";
$rs2 = mysql_query($sql2, $conn);
$row = mysql_fetch_assoc($rs2);
$replies = $row["replies"];
$replies++;
$update = "UPDATE threads SET replies = '$replies' WHERE `id` = '$thread'";
$rs = mysql_query($update) or die(mysql_error());
header("Location: forum.php?area=$area&thread=$thread"); exit();
?>