prepare("INSERT INTO competition_participants (user_id, competition_id) VALUES (?, ?)"); $stmt->execute([$user_id, $competition_id]); } catch (PDOException $e) { // Handle potential errors, like trying to join the same competition twice // You might want to log this error or show a message } } header("location: user_dashboard.php"); exit;