https://www.icyphoenix.com/viewtopic.php?f=26&t=3614&p=24339#p24339
-----------------------------------
KasLimon
Fri 15 Feb, 2008 16:29

Re: Some Help For SQL Needed
-----------------------------------
I've been testing and I got this:
[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
	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="">';
$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]['section_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,
	)
);[/code][/spoiler]
Try it. Greets!


