Extra Block Types (EBT) - New Layout Builder experience❗

Extra Block Types (EBT) - styled, customizable block types: Slideshows, Tabs, Cards, Accordions and many others. Built-in settings for background, DOM Box, javascript plugins. Experience the future of layout building today.

Demo EBT modules Download EBT modules

❗Extra Paragraph Types (EPT) - New Paragraphs experience

Extra Paragraph Types (EPT) - analogical paragraph based set of modules.

Demo EPT modules Download EPT modules

Scroll

Working with Database in Drupal 7 - Lesson 10 - Delete Requests (DELETE)

17/04/2025, by Ivan

Delete queries should use the query builder. They begin with the db_delete() function:


This delete query will remove records from the node table. Note that you do not need to wrap the table name in curly braces—Drupal's query builder handles that automatically. Delete queries use a Fluent API, meaning all methods (except execute()) return the query object itself, just like update and insert queries.

Delete queries are simple and only use WHERE expressions. We’ll cover WHERE conditions in more detail in a future lesson, but for now let’s look at a basic delete query:

condition('nid', 5)
  ->execute();
?>

This query will delete all rows from the node table where nid = 5.

This is equivalent to the following SQL statement:

DELETE FROM {node} WHERE nid=5;

The execute() method returns the number of rows that were deleted as a result of the query.