Hey guys,
Please tell me if I'm doing something completely stupid as I've been looking at this for far too long now and I'm stumped as to what I'm doing wrong.
$rank2 = $rank / $people;
mysql_select_db("test", $con);
$result = mysql_query("SELECT id,username,rank FROM members WHERE username = '$user'");
if (!$result) {
echo 'Could not run query: ' . mysql_error();
exit;
}
$rank3 = $row[2];
$user = $_SESSION['username'];
$row = mysql_fetch_row($result);
mysql_query("UPDATE members SET rank=$rank2 + $rank3
WHERE username='$user'");
The idea is to replace the current entry in the "rank" row for a certain user, with the total of what the current rank is ($row[2] aka $rank3) plus $rank2.
The code seems to work fine if I just try to replace the "rank" row with $rank2, but when I try putting the total of the two together, it doesn't play ball.
I've also tried declaring $rank3 as:
$rank3 = $rank2 + $row[2]
Then tried calling $rank3 into the "SET rank" section of my code.
Stumped. Help?