title: If statement returning else regardless
body: <p>I have a PHP code that gets an id number and then checks if the id exists in the database. If the id is in the database it echos <code>Item Added</code> if not it echos <code>That id is not valid</code> </p>
  
  <p>(Well at least that is what it is supposed to do!)</p>
  
  <p>Right now it echos out <code>Item Added</code> regardless. </p>
  
  <pre><code>$action = $_GET['action'];
  $id     = $_GET['id'];
  
  if ($action == 'add') {
  
      // Check if the id matches one in the database 
      $result = mysqli_query($con,"SELECT COUNT(*) FROM items WHERE id='$id'");
  
      if ($result = 0) {
  
          echo 'That id is not valid!';
      }
      else {
  
          echo 'Item Added';
      }
  }
  </code></pre>
  
  <p>My url for the get actions look like this: </p>
  
  <pre><code>../shopping-functions.php?action=add&amp;id=977
  </code></pre>