You are here

function webfm_dbdelete_attach in Web File Manager 5

Same name and namespace in other branches
  1. 5.2 webfm.module \webfm_dbdelete_attach()

webfm_dbdelete_attach - deletes node file associations given a nid and fid

Parameters

int $nid - node id:

int $fid - file id from the webfm_file table:

Return value

bool - TRUE if success - else FALSE

File

./webfm.module, line 3036

Code

function webfm_dbdelete_attach($nid, $fid) {
  $query = 'DELETE FROM {webfm_attach} WHERE nid = %d AND fid = %d';
  $result = db_query($query, $nid, $fid);
  if ($result === FALSE) {
    drupal_set_message(t('Query Failed: Could not detach file %fid from node %nid', array(
      '%fid' => $fid,
      '%nid' => $nid,
    )));
    return FALSE;
  }
  return TRUE;
}