You are here

function dbtng_example_entry_delete in Examples for Developers 7

Delete an entry from the database.

The usage of db_query is deprecated except for static queries. Formerly, a deletion might have been accomplished like this:


 db_query("DELETE FROM {dbtng_example} WHERE pid = %d", $entry['pid]);

Parameters

array $entry: An array containing at least the person identifier 'pid' element of the entry to delete.

See also

db_delete()

Related topics

1 call to dbtng_example_entry_delete()
DBTNGExampleUnitTestCase::testAPIExamples in dbtng_example/dbtng_example.test
Test several combinations, adding entries, updating and deleting.

File

dbtng_example/dbtng_example.module, line 162
This is an example outlining how a module can make use of the new DBTNG database API in Drupal 7.

Code

function dbtng_example_entry_delete($entry) {
  db_delete('dbtng_example')
    ->condition('pid', $entry['pid'])
    ->execute();
}