Tuesday, 1 October 2013

Example of drupal_write_record or Example of drupal write record

Insert a value into database :

$dataArray = array(
'first_name' => $form_state['values']['first_name'],
'last_name' => $form_state['values']['last_name'],
);
drupal_write_record('mytable_name', $dataArray);

Update a value into database :

$dataArray = array(
'first_name' => $form_state['values']['first_name'],
'last_name' => $form_state['values']['last_name'],
'mytuid' => $mytuid
);

drupal_write_record('mytable_name', $dataArray, 'mytuid');

In Update primary key is mytuid

No comments:

Post a Comment

Thank you so much for providing your valuable feedback. I will will look into them and update my skills & technologies accordingly.