title: Delete one column from table, Update another with PHP MYSQL
body: <p>I have two tables. One table is the matches table (e2wedstrijden) and another table is my scoring table with the points earned etc. (e2teams).</p>
  
  <p>Now I have that I can delete a match from the <strong>e2wedstrijden</strong> table. And this is working fine.</p>
  
  <p>But I want that if I delete a match from that table. It also add or decrease points to the table ("e2teams"). I tried to compare the tables but this is not working.</p>
  
  <p>So I want for example: </p>
  
  <p>If<code>($row['thuisscore'] == $row['uitscore'])</code> what are to row names in my <em>e2wedstrijden</em> table. So if these two are the same (like 0-0 or 1-1 or something) Than it needs to decrease 1 point from the table <em>e2teams</em>. But only by the teams that are the same as the rows "Thuisteam" and "Uitteam" in my <em>e2wedstrijden</em> table. So the Row Thuisteam (in "e2wedstrijden") Needs to find the same result in ("e2teams") row Team. And this needs to be done the same with the Row Uitteam (in "e2wedstrijden") Needs to find the same result in ("e2teams")</p>
  
  <p>Thuisteam and Uitteam = Dutch for hometeam and awayteam. I think my fault is that the system can't link the 'Thuisteam' from <em>e2wedstrijden</em> to the Team in <em>e2teams</em> but don't know how to solve it</p>
  
  <p>This is my <strong>deletematches.php</strong>, It deletes the match but doesn't decrease or adds points:</p>
  
  <pre><code>    &lt;?php
  if(!isset($_COOKIE['E2ingelogd'])) {
  header("location:../../index.php");
  }
  include "../../connect.php";
  $dbhandle = mysql_connect($hostname, $username, $password) or die("Could not connect to database");
  $selected = mysql_select_db("login", $dbhandle);
  $result = mysql_query("SELECT * FROM e2wedstrijden WHERE ID = ".$_GET['del']."");
  
  while($row = mysql_fetch_assoc($result)){
  
  if( $row['thuisscore'] == $row['uitscore']){
        echo $row['thuisscore'];
        mysql_query("UPDATE e2teams SET Punten = Punten-1 WHERE Team ='".$row['Thuisteam']."'");
        mysql_query("UPDATE e2teams SET Gespeeld = Gespeeld-1 WHERE Team = ('".$row['Thuisteam']."'");
        mysql_query("UPDATE e2teams SET Verloren = Gelijk-1 WHERE Team ='".$row['Uitteam']."'");
        echo "Team is deleted";
      }else{
         echo 'Update Error!';
      }
  }
  
  
  $table_1_delete = mysql_query("DELETE FROM e2wedstrijden WHERE ID = ".$_GET['del']."");
  
  
      ?&gt;
  </code></pre>
  
  <p>This is my <strong>e2teams</strong> table:
  <img src="https://i.stack.imgur.com/eKF9S.jpg" alt="E2teamstable">  </p>
  
  <p>And this is my <strong>E2wedstrijden</strong> table:
  <img src="https://i.stack.imgur.com/ZZmra.jpg" alt="E2wedstrijdentable"></p>
  
  <p>So i need something like: </p>
  
  <pre><code>UPDATE e2teams SET Punten = Punten-1 WHERE Team = Look in table ("e2wedstrijden) deleted Thuisteam and deleted Uitteam
  </code></pre>
  
  <p>Hope you can help</p>