Jump to content

Realest89

New Members
  • Posts

    5
  • Joined

  • Last visited

Realest89's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thank you for the information ill take that information into my writing and see where it takes me! does this forum have like a discord where there is support with window sharing at all?
  2. Name Type Collation Attributes Null Default user_id int(11) UNSIGNED No None this is what i see in my database
  3. Hello im using GitHub to help build me a site because i have minimal experience with coding, I have my manager_id set to NOT NULL in my database and i keep getting this error Error: Could not create team. Column 'manager_id' cannot be null Here is the code github keeps giving to clear the error but it doesn't seem to work. // Handle team creation if (isset($_POST['create_team'])) { // Validate form data $name = trim($_POST['teamname']); $tag = trim($_POST['tag']); if (empty($name)) { $errors[] = 'Team name is required.'; } if (empty($tag)) { $errors[] = 'Tag is required.'; } if (empty($errors)) { // Insert new team into the database $sql = "INSERT INTO teams (teamname, tag, manager_id) VALUES (?, ?, ?)"; $stmt = mysqli_prepare($conn, $sql); mysqli_stmt_bind_param($stmt, 'ssi', $name, $tag, $_SESSION['user_id']); $result = mysqli_stmt_execute($stmt); if ($result === false) { $errors[] = 'Error: Could not create team. ' . mysqli_error($conn); } else { $team_id = mysqli_insert_id($conn); // Add the user to the team $sql = "INSERT INTO players (userid, playername, team_id) VALUES (?, ?, ?)"; $stmt = mysqli_prepare($conn, $sql); mysqli_stmt_bind_param($stmt, 'isi', $_SESSION['user_id'], $_SESSION['username'], $team_id); $result = mysqli_stmt_execute($stmt); if ($result === false) { $errors[] = 'Error: Could not add user to team. ' . mysqli_error($conn); } else { header('Location: team.php?id=' . $team_id); exit; } } } } All help is appreciated!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.