title: Update sql query with PHP and variables
body: <p>When I run this page, its says <code>You couldnt execute query</code>. I think there is a syntax problem, but I cannot see the problem.</p>
  
  <p>The variables look fine when I echo them. I added the column names as a code comment. All the columns are <code>VARCHAR</code>.</p>
  
  <p>I don't believe it is a connection problem since I can perform <code>SELECT AND DELETE</code> operations from other <code>php</code> pages.</p>
  
  <pre><code>&lt;?php 
  
  $id = $_POST["id"];
  $name = $_POST["name"];
  $surname = $_POST["surname"];
  $phone = $_POST["phone"];
  
  /* Table in the DDBB(all are VARCHAR): CUST_ID  CUST_FORENAME   CUST_PHONE  CUST_SURNAME*/
  
  $query = "UPDATE customers SET CUST_ID='$id',$CUST_FORENAME='$name',
              CUST_PHONE='$phone', CUST_SURNAME='$surname' WHERE CUST_ID=$id";
  
  $result = mysqli_query ($connection,$query)
      or die ("You couldn’t execute query");
  
  echo "&lt;br /&gt;&lt;br /&gt;User $id has been updated.";
  
  ?&gt;
  &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>