https://www.icyphoenix.com/viewtopic.php?f=26&t=3614&p=24343#p24343
-----------------------------------
KugeLSichA
Fri 15 Feb, 2008 18:16

Re: Some Help for SQL Needed
-----------------------------------
many thanks KasLimon,

now i got it working with your help... with your code there was only showing 2 options, but it was my fault, because we checked the season table "id" but it must be the season table "id_section" (line 3)

i have it working with this code:
[spoiler][code]$sql = "SELECT sec.id AS section_id, sec.name AS section_name, sea.id AS season_id, sea.name AS season_name
	FROM (" . TOURNEY_SECTIONS_TABLE . " sec, " . TOURNEY_SEASONS_TABLE . " sea)
	WHERE sec.id = sea.id_section
	AND sea.deleted = 0
	AND sec.deleted = 0
	ORDER BY sec.name ASC";
if (!$result = $db->sql_query($sql))
{
	message_die(CRITICAL_ERROR, 'Could not query season information', '', __LINE__, __FILE__, $sql);
}
$season_info = $db->sql_fetchrowset($result);
$season_select = '<form action="tourney.' . $phpEx . '?sid=' . $userdata['session_id'] . '" method="post">';
$season_select .= 'Select Season: <select name="season_id" size="1">';
$season_select .= '<option value="0">-</option>';
for ($x = 0; $x < count($season_info); $x++)
{
	$season_select .= '<option value="' . $season_info[$x]['season_id'] . '">' . $season_info[$x]['section_name'] . ' ' . $season_info[$x]['season_name'] . '</option>';
}
$season_select .= '</select>';
$season_select .= '<input type="submit" value="Go">';
$season_select .= '</form>';

$template->assign_vars(array(
	'SEASON_SELECT' => $season_select,
	'I_ID_SEASON' => $season['id'],
	)
);[/code][/spoiler]

again thank you very much =)


