title: PHP array not updating
body: <p>There is probably something dumb I am doing wrong here.</p>
  
  <pre><code>public function get_scores($id)
  {
      $results = array();
      $sql = "SELECT * FROM scores WHERE comp_id = $id";
      $rows = $this-&gt;db-&gt;query($sql)-&gt;result();
      foreach($rows as $row) {
          if($row-&gt;confirmed_id) {
              $results[$row-&gt;uid] += $row-&gt;score;
          }
      }
      sort($results);
      return $results;
  }
  </code></pre>
  
  <p>So basically what I am trying to do is add all of the users scores in the database and return them in order of rank.  confirmed->id is just a check to make sure the score has been confirmed (and thus is addable to their total score).  I am basically trying to just make an associative array where the key is the users ID, and the score of each question they have in the database is added on.  The query works fine, and $row-uid and $row->score both return the correct thing for every row, but $results[] never has anything added to it.   If I even change it just to something silly like $results[3] = 0 at top, and then $results[3]++ or += 1 in the for loop, it doesn't add anything to $results[3].</p>
  
  <p>EDIT: Problem solved. Indeed was something dumb -- confirmed_id was set to null by my partner when he reran our database after I had previously set it all to 1. Thanks guys :)</p>