Update query is not working In a Drupal 7 custom module, I am updating a record in the database using a form, and I am using the following code to update, but for some reason it is not updating. Can anyone tell me why? I tried like 3 hours to change every possible thing but no luck.

function edit_job_form_submit($form, &amp;$form_state){
  $id = $form_state['values']['id'];
  $job_title = $form_state['values']['job_title'];
  $description = $form_state['values']['description'];
  $cat_id = $form_state['values']['cat_id'];
  $job_type = $form_state['values']['job_type'];
  $company_id = $form_state['values']['company_id'];
  $description = $form_state['values']['description'];
  $location = $form_state['values']['location'];
  $Salary = $form_state['values']['Salary'];
  $benifits = $form_state['values']['benifits'];
  $Nationality = $form_state['values']['Nationality'];
  $Age = $form_state['values']['Age'];
  $join_date = $form_state['values']['join_date'];
  $date_added = date("y-m-d", time());

  $join_date_mod = gmdate('Y-m-d',strtotime($join_date));

  $num_updated = db_update('echelon_jobs')-&gt;fields(
    array(
      'job_title' =&gt; $job_title,
      'cat_id' =&gt; $cat_id,
      'job_type' =&gt; $job_type,
      'company_id' =&gt; $company_id,
      'location' =&gt; $location,
      'Salary' =&gt; $Salary,
      'benifits' =&gt; $benifits,
      'Nationality' =&gt; $Nationality,
      'Age' =&gt; $Age,
      'join_date' =&gt; $join_date_mod,
      'date_added' =&gt; $date_added,
    )
  )
  -&gt;condition('id', $id)
  -&gt;execute();

  //dpq($num_updated, $name);
  drupal_set_message(t('Vacancy Updated Successfully..  '));
}
As a matter of debugging, if you have the Devel module installed, try executing the query at devel/php with hard-coded data. That will help understanding if there is an issue with the  db_update(). Also, when you run the query and an error occurs, the error log at admin/reports/dblog on your site should show you any error message about that query.

In case you need to update or insert values on a table, db_merge() should be used instead of db_update(). db_update() doesn't insert new rows, but updates the existing ones; db_merge() updates the existing ones, or creates new rows. 

Once you are ready with a working query, debug the $form_state values; there might a mismatch between database table column type and the data you are trying to put there.