i'm not having a good day today

This code doesn't seem to be doing anything

			// Add points to the correct side
			$team = mysql_query("SELECT `name`,`points` FROM `game_clonewars` WHERE `name` = '".side."'") or die(mysql_error());
			print $team;
			$team1 = mysql_num_rows($team);
            if ($team1 == 1) {	
				while ($row = mysql_fetch_array($team)) {	
					$points2 = $points + $row['points'];
					mysql_query("UPDATE `game_clonewars` set `points` = '".$points2."' WHERE `name` = '".$side."' LIMIT 1") or die(mysql_error());
					echo "Total Team Points: " . $points2 . "";
				}
			}

if i print out the sql, i get

Resource id #5

so obviously i've done something wrong

    Resource id #5 is a reference to the error, to find out how to retrieve it click here. In the meantime try this:

    
    // Add points to the correct side
                $team = mysql_query("SELECT `name`,`points` FROM `game_clonewars` WHERE `name`='$side'") or die(mysql_error());
                print $team;
                $team1 = mysql_num_rows($team);
                if ($team1 == 1) {    
    while ($row = mysql_fetch_array($team)) {
    $points2 = $points + $row['points']; mysql_query("UPDATE `game_clonewars` set `points` ='$points2' WHERE `name`='$side' LIMIT 1") or die(mysql_error()); echo "Total Team Points: ".$points2 ; } }

      Is name unique? I would guess that it is since you check if it is only one result. If it is unique you don't need to check if there is one result, and you don't need to first retreive and then update. In fact, first retreive the value and then update it will cause problems if there are more than one person updating it at the same time. Something like this should be ok:

      $sql = "UPDATE `game_clonewars` set `points` = `points` + $points WHERE `name`='$side'"
      mysql_query($sql) or die(mysql_error()); 
      
        Write a Reply...