public function autoExecutePayments() { //Status 2 orders are confirmed orders ready to collect payment. //This status change automatically whenever the payment is approved by the customer $db = new clsDBdbConnection(); $sql = "select id from orders where status_id = 2"; $db->query($sql); $payments = new Payments(); while ($db->next_record()) { $orderid = (int) $db->f("id"); $payments->executePayment($orderid); } $db->close(); return true; }