title: PHP mysql update int
body: <p>This is my code, it inserts a user_id and a post_id to the table likelist.</p>
  
  <p>This part already works fine.</p>
  
  <p>Now I want to add a "+1" to the table <strong>comments</strong> in the column <strong>likes</strong> wich is an int type, where the post_id equals the one from part 1.</p>
  
  <p>How can I do this?</p>
  
  <pre><code>&lt;?php
  
  //load and connect to MySQL database stuff
  require("config.inc.php");
  
  if (!empty($_POST)) {
      //initial query
      $query = "INSERT INTO likelist ( user_id, post_id) VALUES ( :user, :post ) ";
  
      //Update query
      $query_params = array(
          ':user' =&gt; $_POST['user_id'],
          ':post' =&gt; $_POST['post_id']
  
  
      );
  
      //execute query
      try {
          $stmt   = $db-&gt;prepare($query);
          $result = $stmt-&gt;execute($query_params);
  
  
      }
      catch (PDOException $ex) {
          // For testing, you could use a die and message. 
          //die("Failed to run query: " . $ex-&gt;getMessage());
  
          //or just use this use this one:
          $response["success"] = 0;
          $response["message"] = "Database Error. Couldn't add post!";
          die(json_encode($response));
      }
  
  
      $response["success"] = 1;
      $response["message"] = "Username Successfully Added!";
      echo json_encode($response);
  
  
  
  
  } else {
  ?&gt;
          &lt;h1&gt;Add Like&lt;/h1&gt; 
          &lt;form action="addlike.php" method="post"&gt; 
              User ID:&lt;br /&gt; 
              &lt;input type="text" name="user_id" placeholder="user id" /&gt; 
              &lt;br /&gt;&lt;br /&gt; 
              Post ID:&lt;br /&gt; 
              &lt;input type="text" name="post_id" placeholder="post id" /&gt; 
              &lt;br /&gt;&lt;br /&gt; 
  
              &lt;br /&gt;&lt;br /&gt;
              &lt;input type="submit" value="Add Like" /&gt; 
          &lt;/form&gt; 
      &lt;?php
  }
  
  ?&gt; 
  </code></pre>
  
  <p><strong>EDIT</strong>
  I only want this to happen when the first part succeeds, this makes sure the like is unique and a user cant like one post multiple times.</p>