title: PDO Value Increment PHP, Mysql
body: <p>Hello guys im working on a project for handling spots on a event. I'm trying to update the values of the event spots after someone registers to it. There is no problem with someone registering or reading the values from database but i cant update the spots. Hope you can help..</p>
  
  <p>Here is the not working part of the code : </p>
  
  <pre><code>$free_spots_new = $free_spots - 1 ; // i haven't written the code up there, $free_spots is the value of the free_spots value in the database. And this is the process after someone registers to this event ...
  $full_spots_new = $full_spots + 1 ; // same in here
  
  try{
  $update_event_query = "UPDATE `events` SET `free_spots` = :free_spots, `full_spots`= :full_spots WHERE `event_id`=:event_id";
  $update_event_query_do = $db-&gt;prepare($update_event_query);
  $update_event_query_do -&gt; bindParam(':free_spots', $free_spots_new, PDO::PARAM_INT);
  $update_event_query_do -&gt; bindParam(':full_spots', $full_spots_new, PDO::PARAM_INT);
  $update_event_query_do -&gt;execute() or die(print_r($update_event_query_do-&gt;errorInfo(), true));
  }
  
  catch(PDOException $e) {
  $log-&gt;logError($e." - ".basename(__FILE__));
  }
  </code></pre>
  
  <p>Also is it possible to update the values within the UPDATE line without defining a new variable like $free_spots_new exc.</p>