Delete webform submissions

Public

Webform module default provides "Clear" option that clears all the submissions, if you want to delete specific configurations than use below script, add webform_node_nid and submission_id

</> CopyGet raw version
php
  1. $webform_node_nid = XXX;
  2. $submission_sid = XXX;
  3.  
  4. //Delete from webform submissions data
  5. $num_deleted = db_delete('webform_submitted_data')
  6. ->condition('nid', $webform_node_nid)
  7. ->condition('sid', $submission_sid, '<')
  8. ->execute();
  9.  
  10.  
  11. //Delete from webform submissions
  12. $num_deleted1 = db_delete('webform_submissions')
  13. ->condition('nid', $webform_node_nid)
  14. ->condition('sid', $submission_sid, '<')
  15. ->execute();