Jump to content

Problem displaying result - Help requested


Chezshire

Recommended Posts

I'm trying to build an array (i believe that that is what it is called) that shows the teams/squads and the members of those squads similar to the school clubs which i have already that work. Currently i get no errors and no results. - Any ideas? Help? Please :D

ini_set('error_reporting',E_ALL);

// SQUADRONS

$sql = "SELECT id, name, codename, squadronDB FROM cerebra WHERE approved=\"true\" AND squadronDB IS NOT NULL AND squadronDB != \"\" AND type=\"student\" AND player > 0";
$result = mysql_query($sql);

$squad = array("ALPHA - Alpha Flight (Advisor)",
"ALPHA - Alpha Flight (Field Leader)", "ALPHA - Alpha Flight (Deputy Leader)",
"ALPHA - Alpha Flight", "BETA - Buckaroo Banzias (Advisor)", "BETA - Buckaroo Banzias (Field Leader)", "BETA - Buckaroo Banzias (Deputy Leader)", "BETA - Buckaroo Banzias", "KAPPA - Corsairs (Advisor)", "KAPPA - Corsairs (Field Leader)", "KAPPA - Corsairs (Deputy Leader)", "KAPPA - Corsairs", "DELTA - Paragons (Advisor)", "DELTA - Paragons (Field Leader)", "DELTA - Paragons (Deputy Leader)", "DELTA - Paragons", "EPSILON - Excaliber (Advisor)", "EPSILON - Excaliber (Field Leader)", "EPSILON - Excaliber (Deputy Leader)", "EPSILON - Excaliber", "OMEGA - Omega Gang (Advisor)", "OMEGA - Omega Gang (Field Leader)", "OMEGA - Omega Gang (Deputy Leader)", "OMEGA - Omega Gang");

$squadders = array();

WHILE ($squadders = mysql_fetch_assoc($result)) {
$tempSquad = explode("^", $squadders["squadronDB"]);

foreach ($tempSquad as $thisSquad) {

$key = array_search($thisSquad, $squad);

if ($key) {
if (!isset($squadders[$key])) { $squadders[$key] = array(); }
array_push($squadders[$key], $squadders["id"]);
} // end if in squad list

} // end foreach

} // end WHILE

$col = 0;

echo "<br>\n<h2><font color='#A5B9D5'>TRAINING SQUADRONS</font></h2>\n";

echo "<hr color='#050F1D' size='5'>\n";

echo "<table cellpadding='0'><tr>";
for ($i =0; $i < count($squad); $i++) {

if (isset($squadders[$i])) {
if ($col == 0) { echo "<td valign='top'>"; }
echo "<p><b>$squad[$i]</b><br>\n";
foreach ($squadders[$i] as $thisSquadders) {
$safeName = preg_replace("/\"/", """, getSquad($thisSquadders));
$realName = getRealName($thisSquadders);
if ($realName == "(Unrevealed)") { $realName = $safeName; }
echo "<span class='fineprint'><a href=\"/cerebra/display.php?id=$thisSquadders\" title=\"$safeName\">$realName</a></span><br>\n"; }
echo "</p>\n";
$col++;
if ($col == 6) { echo "</td><td width='25'></td>\n"; $col=0; }
} // end if any students in this squad

} // end for

IF ($col < 4) { echo "</td>"; }

echo "</tr></table>\n";

 

 

 

 

This is the original code i built which I am trying to repurpose:

// SCHOOL CLUBS

$sql = "SELECT id, schoolclubs FROM cerebra WHERE approved=\"true\" AND schoolclubs IS NOT NULL AND schoolclubs != \"\" AND type=\"student\" AND player > 0";
$result = mysql_query($sql);

$clubs = array("Archery", "Art", "Computer", "Chess", "Debate", "Drama", "GBLT(S)", "Independant Study", "Language", "Martial Arts", "Music", "Science", "Sports");

$clubbers = array();

WHILE ($clubber = mysql_fetch_assoc($result)) {
$tempClubs = explode("^", $clubber["schoolclubs"]);

foreach ($tempClubs as $thisClub) {

$key = array_search($thisClub, $clubs);

if ($key) {
if (!isset($clubbers[$key])) { $clubbers[$key] = array(); }
array_push($clubbers[$key], $clubber["id"]);
} // end if in club list

} // end foreach

} // end WHILE

$col = 0;

echo "<br>\n<h2><font color='#A5B9D5'>School Clubs</font></h2>\n";

echo "<hr color='#050F1D' size='5'>\n";

echo "<table cellpadding='0'><tr>";
for ($i =0; $i < count($clubs); $i++) {

if (isset($clubbers[$i])) {
if ($col == 0) { echo "<td valign='top'>"; }
echo "<p><b>$clubs[$i]</b><br>\n";
foreach ($clubbers[$i] as $thisClubber) {
$safeName = preg_replace("/\"/", """, getChar($thisClubber));
$realName = getRealName($thisClubber);
if ($realName == "(Unrevealed)") { $realName = $safeName; }
echo "<span class='fineprint'><a href=\"/cerebra/display.php?id=$thisClubber\" title=\"$safeName\">$realName</a></span><br>\n"; }
echo "</p>\n";
$col++;
if ($col == 4) { echo "</td><td width='25'></td>\n"; $col=0; }
} // end if any students in this club

} // end for

IF ($col < 4) { echo "</td>"; }

echo "</tr></table>\n";

 

the results can be seen here: http://www.xpg.us/institute/institute2.php

Hi -- I'm hoping someone can help me to figure out why I'm unable to get any errors or display results. I just tried changing the 'getSquad' function to 'getChar' like i have in the 'school clubs' which works. That didn't work though sadly, does anyone have any ideas, tips, cliffs they can push me off of maybe? Thanks for any and all help

=Chez (and for those who asked earlier - i have two chemo visits left and it looks like i'm responding favorably -- thank you!)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.