- $r = q("SELECT `id` FROM `gcontact` WHERE `nurl` = '%s'", dbesc(normalise_link($orig_profile)));
- if (DBM::is_result($r)) {
- q("DELETE FROM `gcontact` WHERE `nurl` = '%s'", dbesc(normalise_link($orig_profile)));
- q("DELETE FROM `glink` WHERE `gcid` = %d", intval($r[0]["id"]));
+ if (dba::exists('gcontact', ['nurl' => normalise_link($orig_profile)])) {
+ dba::delete('gcontact', ['nurl' => normalise_link($orig_profile)]);