Tuesday, June 21, 2011

Example of drupal_write_record or Example of drupal write record

Insert a value into database :

$transition = array(
'sid' => $form_state['values']['new_transition_from'],
'target_sid' => $form_state['values']['new_transition_to'],
'roles' => $tabroles,
);
drupal_write_record('workflow_transitions', $transition);

Update a value into database :

$transition = array(
'sid' => $form_state['values']['new_transition_from'],
'target_sid' => $form_state['values']['new_transition_to'],
'roles' => $tabroles,
'tid' => $tid
);

drupal_write_record('workflow_transitions', $transition, 'tid');

In Update primary key is tid

No comments:

Post a Comment