In my table I have two divisions. Axis and Allied div_id = 1 and div_id = 2.
I have a script the has a list box that displays all teams from the opposing div_id meaning it displays all teams != to your div_id.
The problem is when I select one of the opposing teams in the list box the only team_id that gets written to the table is the last one.
First I find my current div_id based on my username on the site and if it is listed as a commander.
//Find the value of the division ID.
$nukeusername = $userinfo['username'];
$sql = "SELECT div_id FROM " . $prefix . "_eto_divisions
WHERE (div_commander ='$nukeusername' || div_xo ='$nukeusername')";
$result = $db->sql_query($sql);
$mydiv = $db->sql_fetchrow($result);
$div_id = $mydiv[div_id];
Then I filter the values of the teams I want to display.
//Filter the values for the list box.
$result = $db->sql_query("SELECT * FROM " . $prefix . "_tc_ladderteams tclt
LEFT JOIN " . $prefix . "_tc_teams tct ON (tclt.team_id = tct.team_id)
LEFT JOIN " . $prefix . "_eto_campaigns ec ON (tclt.ladder_id = ec.cid)
LEFT JOIN " . $prefix . "_tc_ladders tcl ON (tcl.sid = tclt.ladder_id)
WHERE tct.div_id != $div_id
AND tcl.active = 1
AND tct.is_active = 1");
Then I show my list box.
while ( $row = $db->sql_fetchrow($result) ) {
$dteam_name = $row["name"];
$dteam_id = $row["team_id"];
echo "<option value='$dteam_id'>$dteam_name</option>";
}
echo "</select>";// Closing of list box
I may have 8 or 10 teams signed up as Axis but no matter who I choose in the list box the only team_id that gets wriiten is the very last team_id for the Axis. team_id = 153
I'm confused.