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, &$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')->fields(
array(
'job_title' => $job_title,
'cat_id' => $cat_id,
'job_type' => $job_type,
'company_id' => $company_id,
'location' => $location,
'Salary' => $Salary,
'benifits' => $benifits,
'Nationality' => $Nationality,
'Age' => $Age,
'join_date' => $join_date_mod,
'date_added' => $date_added,
)
)
->condition('id', $id)
->execute();
//dpq($num_updated, $name);
drupal_set_message(t('Vacancy Updated Successfully.. '));
}
dpq()
call, and run it against the database manually. That will tell you what the problem is.