showing results for - "drupal 7 db delete node programmatically based on condition"
Brock
17 Apr 2016
1<?php
2
3// Drupal 7
4$nid = 5;
5$num_deleted = db_delete('node')
6  ->condition('nid', $nid)
7  ->execute();
8
9// Above example is equivalent to the following in Drupal 6
10$nid = 5;
11db_query("DELETE FROM {node} WHERE nid = %d", $nid);
12
13?>
14