I hope someone can help me to solve this...
I have this code:
Spoiler: [ Show ]
Spoiler: [ Hide ]
<?php
$template->_tpldata['signup_players.'] = array();
$template->_tpldata['no_players'] = array();
// users-query
$sql = "SELECT u.* FROM " . TOURNEY_SEASON_USERS_TABLE . " su, " . USERS_TABLE . " u
WHERE su.id_season = " . $_REQUEST['season_id'] . "
AND su.usertype_player = 1
AND su.rejected = 0
AND su.id_user = u.user_id
ORDER BY su.submitted ASC";
if (!($result = $db->sql_query($sql)))
{
message_die(GENERAL_ERROR, 'Could not connect to tourney users and season users table.', '', __LINE__, __FILE__, $sql);
}
$signuprow = array();
while ($row = $db->sql_fetchrow($result))
{
$signuprow[] = $row;
}
$db->sql_freeresult($result);
$total_players = count($signuprow);
$cols_number = 4;
$rows_number = $total_players / $cols_number;
if ($total_players > 0)
{
$player_counter = 0;
while( $player_counter < $total_players )
{
for ($x = 0; $x < $rows_number; $x++)
{
$template->assign_block_vars('signup_players', array());
for ($y = 0; $y < $cols_number; $y++)
{
if ( $player_counter >= $total_players )
{
$template->assign_block_vars('signup_players.no_detail', array());
}
else
{
$sql = "SELECT f.flag_image, f.flag_name, u.user_from_flag
FROM " . FLAG_TABLE . " AS f
LEFT JOIN " . USERS_TABLE . " AS u ON f.flag_image = u.user_from_flag
WHERE f.flag_image = '" . $signuprow[$player_counter]['user_from_flag'] . "'";
if(!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, 'Could not obtain last edit information from the database', '', __LINE__, __FILE__, $sql);
}
$flagrow = $db->sql_fetchrow($result);
$player = colorize_username($signuprow[$player_counter]['user_id']);
$template->assign_block_vars('signup_players.detail', array(
'PLAYER' => $player,
'PLAYER_COUNTER' => $player_counter + 1,
'FLAG_IMAGE' => $signuprow[$player_counter]['user_from_flag'],
//'FLAG_NAME' => $flagrow['flag_name']
)
);
}
$player_counter++;
}
}
}
}
else
{
$template->assign_block_vars('no_players', array());
}
$template->assign_vars(array(
'S_COL_WIDTH' => (100 / ( ($cols_number == 0) ? 4 : $cols_number )) . '%',
)
);
?>
$template->_tpldata['signup_players.'] = array();
$template->_tpldata['no_players'] = array();
// users-query
$sql = "SELECT u.* FROM " . TOURNEY_SEASON_USERS_TABLE . " su, " . USERS_TABLE . " u
WHERE su.id_season = " . $_REQUEST['season_id'] . "
AND su.usertype_player = 1
AND su.rejected = 0
AND su.id_user = u.user_id
ORDER BY su.submitted ASC";
if (!($result = $db->sql_query($sql)))
{
message_die(GENERAL_ERROR, 'Could not connect to tourney users and season users table.', '', __LINE__, __FILE__, $sql);
}
$signuprow = array();
while ($row = $db->sql_fetchrow($result))
{
$signuprow[] = $row;
}
$db->sql_freeresult($result);
$total_players = count($signuprow);
$cols_number = 4;
$rows_number = $total_players / $cols_number;
if ($total_players > 0)
{
$player_counter = 0;
while( $player_counter < $total_players )
{
for ($x = 0; $x < $rows_number; $x++)
{
$template->assign_block_vars('signup_players', array());
for ($y = 0; $y < $cols_number; $y++)
{
if ( $player_counter >= $total_players )
{
$template->assign_block_vars('signup_players.no_detail', array());
}
else
{
$sql = "SELECT f.flag_image, f.flag_name, u.user_from_flag
FROM " . FLAG_TABLE . " AS f
LEFT JOIN " . USERS_TABLE . " AS u ON f.flag_image = u.user_from_flag
WHERE f.flag_image = '" . $signuprow[$player_counter]['user_from_flag'] . "'";
if(!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, 'Could not obtain last edit information from the database', '', __LINE__, __FILE__, $sql);
}
$flagrow = $db->sql_fetchrow($result);
$player = colorize_username($signuprow[$player_counter]['user_id']);
$template->assign_block_vars('signup_players.detail', array(
'PLAYER' => $player,
'PLAYER_COUNTER' => $player_counter + 1,
'FLAG_IMAGE' => $signuprow[$player_counter]['user_from_flag'],
//'FLAG_NAME' => $flagrow['flag_name']
)
);
}
$player_counter++;
}
}
}
}
else
{
$template->assign_block_vars('no_players', array());
}
$template->assign_vars(array(
'S_COL_WIDTH' => (100 / ( ($cols_number == 0) ? 4 : $cols_number )) . '%',
)
);
?>
<!-- INCLUDE tourney_main_body.tpl -->
<table class="forumlinenb" width="100%" cellspacing="0" cellpadding="0" align="center">
<tr><th colspan="{S_COL_WIDTH}">{L_T_PLAYERS_OVERVIEW}</th></tr>
<!-- BEGIN no_players -->
<tr><td class="row1 row-center" colspan="{S_COL_WIDTH}">{L_T_NO_PLAYERS}</td></tr>
<!-- END no_players -->
<!-- BEGIN signup_players -->
<tr>
<!-- BEGIN detail -->
<td class="row1 row-center" width="{S_COL_WIDTH}">
<table>
<tr>
<td><span class="genmed">{signup_players.detail.PLAYER_COUNTER}</span></td>
<td><span class="genmed"><img src="images/flags/{signup_players.detail.FLAG_IMAGE}" /></span></td>
<td><span class="genmed">{signup_players.detail.PLAYER}</span></td>
</tr>
</table>
</td>
<!-- END detail -->
<!-- BEGIN no_detail -->
<td class="row1 row-center"><span class="genmed"> </span></td>
<!-- END no_detail -->
</tr>
<!-- END signup_players -->
</table>{IMG_TFL}{IMG_TFC}{IMG_TFR}
<br />
<table class="forumlinenb" width="100%" cellspacing="0" cellpadding="0" align="center">
<tr><th colspan="{S_COL_WIDTH}">Countries Overview</th></tr>
<tr><td class="row1 row-center" colspan="{S_COL_WIDTH}">no countries</td></tr>
</table>{IMG_TFL}{IMG_TFC}{IMG_TFR}
<!-- close nav table -->
</td>
</tr>
</table>{IMG_TFL}{IMG_TFC}{IMG_TFR}
<table class="forumlinenb" width="100%" cellspacing="0" cellpadding="0" align="center">
<tr><th colspan="{S_COL_WIDTH}">{L_T_PLAYERS_OVERVIEW}</th></tr>
<!-- BEGIN no_players -->
<tr><td class="row1 row-center" colspan="{S_COL_WIDTH}">{L_T_NO_PLAYERS}</td></tr>
<!-- END no_players -->
<!-- BEGIN signup_players -->
<tr>
<!-- BEGIN detail -->
<td class="row1 row-center" width="{S_COL_WIDTH}">
<table>
<tr>
<td><span class="genmed">{signup_players.detail.PLAYER_COUNTER}</span></td>
<td><span class="genmed"><img src="images/flags/{signup_players.detail.FLAG_IMAGE}" /></span></td>
<td><span class="genmed">{signup_players.detail.PLAYER}</span></td>
</tr>
</table>
</td>
<!-- END detail -->
<!-- BEGIN no_detail -->
<td class="row1 row-center"><span class="genmed"> </span></td>
<!-- END no_detail -->
</tr>
<!-- END signup_players -->
</table>{IMG_TFL}{IMG_TFC}{IMG_TFR}
<br />
<table class="forumlinenb" width="100%" cellspacing="0" cellpadding="0" align="center">
<tr><th colspan="{S_COL_WIDTH}">Countries Overview</th></tr>
<tr><td class="row1 row-center" colspan="{S_COL_WIDTH}">no countries</td></tr>
</table>{IMG_TFL}{IMG_TFC}{IMG_TFR}
<!-- close nav table -->
</td>
</tr>
</table>{IMG_TFL}{IMG_TFC}{IMG_TFR}
which results in this:
but i also want to count the countries and layers like here for example:
Did someone of you know how to, and can help me with this???
thanks