prepare( "UPDATE `paymentsLogSyriaDriver` SET status = :status, updated_at = NOW() WHERE order_ref = :order_ref AND status = 2" ); $stmt->execute([ ':status' => $payment_status, ':order_ref' => $orderRef ]); if ($stmt->rowCount() > 0) { http_response_code(200); file_put_contents($log_file, "SUCCESS: Database updated." . PHP_EOL, FILE_APPEND); } else { http_response_code(200); file_put_contents($log_file, "INFO: Order not found or already processed." . PHP_EOL, FILE_APPEND); } } catch (PDOException $e) { http_response_code(500); file_put_contents($log_file, "FATAL: Database update failed: " . $e->getMessage() . PHP_EOL, FILE_APPEND); } ?>