title: Error sql syntax in update query
body: <p>i have this query which i use in order to update a table, the issue is i ge this error:</p>
  
  <pre><code>You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'emri='Albana', klienti='Distribrands', telefoni='0662080090', montim='Kompjut' at line 1
  </code></pre>
  
  <p>I can't find the error here.. it's strange...
  Please help me with this.
  It's an update query!
  The query :</p>
  
  <pre><code>$sqlStart="UPDATE forma SET ";
  $sql="";
  if ($postDyqani_pergjegjes!= 'undefined') $sql .= " dyqani_pergjegjes='$postDyqani_pergjegjes',";
  if ($postEmri!= 'undefined') $sql .= "  emri='$postEmri',";
  if ($postKlienti!= 'undefined') $sql .= "  klienti='$postKlienti',";
  if ($postTelefoni!= 'undefined') $sql .= "  telefoni='$postTelefoni',";
  if ($postMontim!= 'undefined') $sql .= "  montim='$postMontim',";
  if ($postAdresa!= 'undefined') $sql .= "  adresa='$postAdresa',";
  if ($postData_e_shitjes!= 'undefined') $sql .= "  data_e_shitjes='$postData_e_shitjes',";
  if ($postDifekti!= 'undefined') $sql .= "  difekti='$postDifekti',";
  if ($postTekniku_emer!= 'undefined') $sql .= "  tekniku_emer='$postTekniku_emer',";
  if ($postTekniku_mesazh!= 'undefined') $sql .= "  tekniku_mesazh='$postTekniku_mesazh',";
  if ($postData_fillim!= 'undefined') $sql .= "  data_fillim='$postData_fillim',";
  if ($postData_mbarim!= 'undefined') $sql .= "  data_mbarim='$postData_mbarim',";
  if ($postData!= 'undefined') $sql .= "  data='$postData',";
  if ($postStatus!= 'undefined') $sql .= "  status='$postStatus',";
  // replace the last `,` for `;`
  if ($sql != "") {
      // replace the last `,` for `;`
      $sql = substr($sql, 0, -1) . ";";
      // run sql command
      $sqlCommand = $sqlStart.$sql;
      $result=mysql_query($sql) or die(mysql_error()) ;
  
  } else {
      // no fields to update
  }
  </code></pre>
  
  <p>Thanks</p>