My problem is that the games only come up for the first person and not any others. If I put the games query inside the wile it runs needless queries. How do I fix this. A Screen shot and the code is below!
PHP Code:
// ###################### Start list #######################
if ($_REQUEST['do'] == 'list')
{
$applicants = $DB_site->query("
SELECT *
FROM " . TABLE_PREFIX . "clan_recruitment
ORDER BY submitdate desc, callsign
");
if ($DB_site->num_rows($applicants))
{
print_form_header('clanrecruitment', 'ranks');
print_table_header($vbphrase['recruitment_manager'], 5);
echo "
<col width=\"100%\" align=\"$stylevar[left]\"></col>
<col align=\"center\" style=\"white-space: nowrap\"></col>
<col align=\"center\" style=\"white-space: nowrap\"></col>
<col align=\"center\" style=\"white-space: nowrap\"></col>
<col align=\"center\" style=\"white-space: nowrap\"></col>
";
print_cells_row(array(
$vbphrase['applicant'],
$vbphrase['submit_date'],
$vbphrase['email'],
$vbphrase['games'],
$vbphrase['controls']
), 1, '', -1);
$games = $DB_site->query("
SELECT *
FROM " . TABLE_PREFIX . "clan_game
ORDER BY displayorder
");
while ($applicant = $DB_site->fetch_array($applicants))
{
if ($DB_site->num_rows($games))
{
while ($game = $DB_site->fetch_array($games))
{
if ($applicant["game_$game[gameid]"] == 1)
{
$applicant['games'] .= "$game[title]<br />";
}
}
}
$cell = array();
$cell[] = "$applicant[firstname] <strong>\"$applicant[callsign]\"</strong> $applicant[lastname]";
$cell[] = vbdate($vboptions['dateformat'], $applicant['submitdate'], true);
$cell[] = $applicant['email'];
$cell[] = $applicant['games'];
$cell[] = construct_link_code($vbphrase['view'], "clanrecruitment.php?$session[sessionurl]do=view&recruitmentid=$applicant[recruitmentid]") . construct_link_code($vbphrase['delete'], "clanrecruitment.php?$session[sessionurl]do=remove&recruitmentid=$applicant[recruitmentid]");
print_cells_row($cell);
}
print_table_footer();
}
else
{
print_stop_message('no_clan_members_defined');
}
}