You are here

function dba_delete_row in Database Administration 5

1 string reference to 'dba_delete_row'
dba_admin_tables_view in ./dba.module
Display the contents of the selected table.

File

./dba.module, line 537
Allows administrators direct access to their Drupal database. Written by Jeremy Andrews <jeremy@kerneltrap.org>, June 2004. PostgreSQL functionality provided by AAM <aam@ugpl.de> Major security audit, porting, and maintenance by Derek…

Code

function dba_delete_row($table, $key, $keyid) {
  $rows = array();
  $keyid = str_replace('__2F_', '/', $keyid);
  $result = db_query("SELECT * FROM %s WHERE %s = '%s'", $table, $key, $keyid);
  $row = db_fetch_array($result);
  $rows[] = array_map('check_plain', (array) $row);
  $header = array_map('check_plain', array_keys($row));
  $form = array();
  $form['row'] = array(
    '#value' => theme('table', $header, $rows),
  );
  $form['table'] = array(
    '#type' => 'hidden',
    '#value' => $table,
  );
  $form['key'] = array(
    '#type' => 'hidden',
    '#value' => $key,
  );
  $form['keyid'] = array(
    '#type' => 'hidden',
    '#value' => $keyid,
  );
  $form = confirm_form($form, t('Are you sure you want to delete this row from the "%table" table?', array(
    '%table' => $table,
  )), "admin/build/database/table/{$table}/view", t('By clicking "Delete row" you will permanently remove this row from the %table table.  This action cannot be undone.', array(
    '%table' => $table,
  )), t('Delete row'), t('Cancel'));
  return $form;
}