title: MySQL UPDATE Value of column and ADD new value with old value
body: <p>I have a page that shows the leader board score for all users that have registered in the system, which is stored in my database.</p>
  
  <p><strong>Table 1</strong>: </p>
  
  <p><code>Points_hisotry</code> table:</p>
  
  <pre><code>| points_id || user_id(fk) || point_hist |
  |___________||_____________||____________|
  |      1    ||     10      ||    100     |  
  |___________||_____________||____________|
  |      2    ||     11      ||     30     |
  |___________||_____________||____________|
  |      3    ||     11      ||     70     |
  |___________||_____________||____________|
  |      4    ||     11      ||    200     |
  </code></pre>
  
  <p><strong>Table 2</strong>:</p>
  
  <p><code>Users</code> Table:</p>
  
  <pre><code>| users_id ||  username || firstname  || lastname ||
  |__________||___________||____________||__________||
  |    10    ||   alan1   ||    Alan    ||  Smith   ||
  |__________||___________||____________||__________||
  |    11    ||   Jaz12   ||    Jass    ||  Hopal   ||
  |__________||___________||____________||__________||
  |    12    ||   Shubs   ||    shubs   ||  hawash  ||
  |__________||___________||____________||__________||
  |    13    ||   John    ||    Rob     ||  engli   ||
  </code></pre>
  
  <p>In the <code>points_history</code> table, I have 3 rows with the same <code>users_id</code> where I need them to be summed up so I end up with total <code>Point_hist</code> for that <code>users_id</code> which should add up to 300.</p>
  
  <p>I need a query to help me join this tables, then sum the rows of the same <code>users_id</code> to one and print it out on my scoreboard.</p>
  
  <p>I have tried plenty of queries, but I have not got it right.</p>
  
  <p>Here is some of my PHP from <strong>leaderboard.php</strong>:</p>
  
  <pre><code>$sql = "SELECT * FROM users, points_history WHERE users.users_id = points_history.users_id"; 
  $user_query = mysqli_query($db_conx, $sql);
      while ($row = mysqli_fetch_array($user_query, MYSQLI_ASSOC)) {
      $username = $row ["username"];
      $point_hist = $row["point_hist"];
  </code></pre>
  
  <p>The above query is to print out all of the <code>username</code>, and their points from the above two table.</p>
  
  <p>I am new to this, so I need some help please.</p>