$max_amount) { $error = "Minimum amount cannot be greater than maximum amount."; } elseif ($max_amount > $available_amount) { $error = "Maximum amount cannot be greater than the total available amount."; } else { try { $pdo = db(); $stmt = $pdo->prepare( "INSERT INTO ads (user_id, ad_type, currency, payment_currency, price_type, fixed_price, available_amount, min_amount, max_amount, bank_name, comment, status) VALUES (:user_id, :ad_type, :currency, :payment_currency, 'FIXED', :fixed_price, :available_amount, :min_amount, :max_amount, :bank_name, :comment, 'ACTIVE')" ); $stmt->bindParam(':user_id', $user_id, PDO::PARAM_INT); $stmt->bindParam(':ad_type', $ad_type, PDO::PARAM_STR); $stmt->bindParam(':currency', $currency, PDO::PARAM_STR); $stmt->bindParam(':payment_currency', $payment_currency, PDO::PARAM_STR); $stmt->bindParam(':fixed_price', $fixed_price); $stmt->bindParam(':available_amount', $available_amount); $stmt->bindParam(':min_amount', $min_amount); $stmt->bindParam(':max_amount', $max_amount); $stmt->bindParam(':bank_name', $bank_name, PDO::PARAM_STR); $stmt->bindParam(':comment', $comment, PDO::PARAM_STR); if ($stmt->execute()) { $message = "Ad created successfully!"; } else { $error = "Failed to create ad. Please try again."; } } catch (PDOException $e) { // In a real app, you'd log this error, not show it to the user $error = "Database error: " . $e->getMessage(); } } } ?> Create New Ad

Create a New Advertisement

Fill out the form below to post your ad.