From d95336537afb4bea9da738b5e6a62c605658b1ad Mon Sep 17 00:00:00 2001 From: Flatlogic Bot Date: Mon, 20 Oct 2025 23:38:41 +0000 Subject: [PATCH] 3 --- add_club.php | 3 ++- add_tournament.php | 14 +++++++++++--- db/setup.php | 12 +++++++++++- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/add_club.php b/add_club.php index 57f1c64..3c74a57 100644 --- a/add_club.php +++ b/add_club.php @@ -1,4 +1,5 @@ - + \ No newline at end of file diff --git a/add_tournament.php b/add_tournament.php index eb6d016..21b920b 100644 --- a/add_tournament.php +++ b/add_tournament.php @@ -1,4 +1,5 @@ prepare( + 'INSERT INTO tournaments (name, description) VALUES (?, ?)' + ); + $stmt->execute([$tournament_name, $description]); + $success_message = 'Tournament \''. htmlspecialchars($tournament_name) .'\' has been added successfully!'; + } catch (PDOException $e) { + $error_message = 'Database error: ' . $e->getMessage(); + } } } ?> diff --git a/db/setup.php b/db/setup.php index 60f538f..ef76881 100644 --- a/db/setup.php +++ b/db/setup.php @@ -31,6 +31,16 @@ try { ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; "); + // Create tournaments table + $pdo->exec(" + CREATE TABLE IF NOT EXISTS `tournaments` ( + `id` INT AUTO_INCREMENT PRIMARY KEY, + `name` VARCHAR(255) NOT NULL, + `description` TEXT, + `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + "); + // Check if superadmin exists $stmt = $pdo->prepare("SELECT id FROM users WHERE username = 'superadmin'"); $stmt->execute(); @@ -56,4 +66,4 @@ try { } catch (PDOException $e) { die("Database setup failed: " . $e->getMessage()); -} +} \ No newline at end of file