Okay, I have an achievement system and it works great except for correctly adding up the points. Here is an example of updating to the database if conditions are met:
if($members['Active']==1){
$Achievement1=mysql_query("SELECT * FROM ".
"myachievements WHERE ".
"Handle='$members[Handle]' and AchievementId='1'");
$Achievement2=mysql_num_rows($Achievement1);
$tehdate=date('Y-m-d');
$Points = '50';
$newscore=$members['Points']+$Points;
if ($Achievement2 == 0) {
mysql_query("INSERT INTO `myachievements`
( `Handle` , `AchievementId` , `Date` ) VALUES
('$members[Handle]', '1' , '$tehdate')"
)or die(mysql_error());
mysql_query ("UPDATE members SET Achievement = 'Y' WHERE ".
"Handle = '$members[Handle]'")or die(mysql_error());
mysql_query ("UPDATE members SET Points = '$newscore' WHERE ".
"Handle = '$members[Handle]'")or die(mysql_error());
}
}
The achievement shown above is just for activating an account. I have about 35 achievements right now each with a different ID. So there are 35 sets of those two if statements in my main include file. My test user profile from my members table already meets the conditions for 19 of the total of 35 achievements. Everything updates in the database correctly except for adding the Points. The point total should be upwards of around 1000 points, but it always gives me 150. I’m not sure what I’m doing wrong. Any help would be appreciated.
I can not say specifically why it does not add the points, after moving the database stuff into functions of it’s own I would say it’s because you do not increase and store the base point value in
$members['Points']: