You are here

function og_deleteifpresent_2keys in Organic groups 5.2

Same name and namespace in other branches
  1. 5.8 og.install \og_deleteifpresent_2keys()
  2. 5 og.install \og_deleteifpresent_2keys()
  3. 5.3 og.install \og_deleteifpresent_2keys()
  4. 5.7 og.install \og_deleteifpresent_2keys()
3 calls to og_deleteifpresent_2keys()
og_update_1 in ./og.install
og_update_3 in ./og.install
og_update_5 in ./og.install
feb 19, 2006 add a row for each combination of public node and group. needed to make public nodes show up in group homepage for non subscribers

File

./og.install, line 102

Code

function og_deleteifpresent_2keys($sTable, $aField, $aReplace, $aValue) {
  $sqlExist = "select count(*) as nCount " . "from " . $sTable . " where " . $aField[0] . " = " . $aReplace[0] . " and " . $aField[1] . " = " . $aReplace[1];
  $resExist = db_query($sqlExist, $aValue[0], $aValue[1]);
  $objExist = db_fetch_object($resExist);
  if ($objExist->nCount > 0) {

    // found.  delete before inserting below.
    $sqlExist = "delete from " . $sTable . " where " . $aField[0] . " = " . $aReplace[0] . " and " . $aField[1] . " = " . $aReplace[1];
    db_query($sql, $aValue[0], $aValue[1]);
  }
}