select records that could potentially be charged by authenet repeat with anOrder in resutlset if (tManuallyAuthorized = "no") then if (tTimesNotified < 4) then // send them an email asking them to approve it else // they have been bothered enough by the emails, cancel the order end if; continue; end if; status = authorize(); if (status = "good") then // card charged, update the order in some way else // order failed charging, send them an email or something end if; end repeat;