prepare(" UPDATE affiliates SET type = ?, company_name = ?, incharge_name = ?, state = ?, postal_code = ?, place_name = ?, mobile = ?, email = ?, url = ?, signup_reward = ?, status = ?, updated_at = NOW() WHERE id = ? "); $stmt->execute([ $type, $company_name, $incharge_name, $state, $postal_code, $place_name, $mobile, $email, $url, $signup_reward, $status, $affiliate_id ]); logActivity($_SESSION['admin_id'], 'update_affiliate', "Updated affiliate #$affiliate_id", 'affiliate', $affiliate_id); $success = 'Affiliate updated successfully!'; } catch (Exception $e) { $error = 'An error occurred. Please try again.'; error_log("Update affiliate error: " . $e->getMessage()); } } } } // Fetch affiliate details try { $pdo = getDBConnection(); $stmt = $pdo->prepare("SELECT * FROM affiliates WHERE id = ?"); $stmt->execute([$affiliate_id]); $affiliate = $stmt->fetch(); if (!$affiliate) { header('Location: supply.php'); exit; } } catch (Exception $e) { error_log("Fetch affiliate error: " . $e->getMessage()); header('Location: supply.php'); exit; } $indian_states = [ 'Andhra Pradesh', 'Arunachal Pradesh', 'Assam', 'Bihar', 'Chhattisgarh', 'Goa', 'Gujarat', 'Haryana', 'Himachal Pradesh', 'Jharkhand', 'Karnataka', 'Kerala', 'Madhya Pradesh', 'Maharashtra', 'Manipur', 'Meghalaya', 'Mizoram', 'Nagaland', 'Odisha', 'Punjab', 'Rajasthan', 'Sikkim', 'Tamil Nadu', 'Telangana', 'Tripura', 'Uttar Pradesh', 'Uttarakhand', 'West Bengal', 'Andaman and Nicobar Islands', 'Chandigarh', 'Dadra and Nagar Haveli and Daman and Diu', 'Delhi', 'Jammu and Kashmir', 'Ladakh', 'Lakshadweep', 'Puducherry' ]; include 'includes/header.php'; ?>
Update affiliate information for