digatle

Joined: Feb 07, 2006
Posts: 13
|
Posted:
Tue Mar 28, 2006 10:34 am |
|
I'm in need of assistance with a join? or left join? problem I'm having. I put the ? marks there cause I don't exactly know if that's what I'm needing.
What I have is something like this.
When I click on the "standings" of this League software that I have it puts me in the "Main Hall". That I want to have all the time.
But within each of the leagues there are "seasons" which players play in.
Here's how the code's layed out.
/* mainhall display */
| Code: |
function mainhall_display_division_table($did, $name, $sid, $lid, $disp=1) {
global $bgcolor1, $bgcolor2;
$prefs = getLeaguePrefs($lid);
if ($rowcolor != "")
$color="bgcolor=\"$prefs[rowcolor]\"";
else
$color="";
$standings = new Standings($lid);
$max = $standings->size();
$str = "<table width=\"100%\" cellpadding=\"1\" cellspacing=\"0\" border=\"0\" bgcolor=\"$bgcolor1\">";
$str .= "<tr bgcolor=\"$bgcolor2\"><td colspan=\"" . ($max + 3) . "\"><font class=\"option\"><center>$name - Works<br></font>";
if (isAdminLeague($lid, ADD_TEAM) and $disp) {
$str .= " [ <a href=\"modules.php?name=League&file=admin&op=add_team&did=$did&lid=$lid&sid=$sid\">" . _ADDTEAM . "</a> | <a href=\"modules.php?name=League&file=admin&op=recreate_standings_ok&sid=$sid&lid=$lid\">" . _RECREATESTANDING . "</a> | <a href=\"modules.php?name=League&file=admin&op=recalc_standings&sid=$sid&lid=$lid\">" . _RECALCSTANDING . "</a>] ";
$plugin = new Plugins($lid);
echo $plugin->getLinks(PLUGIN_STANDINGS_DIVISION);
}
$str .= "</center></td></tr>";
$str .= "<tr><td bgcolor=\"1c0032\"</td><td bgcolor=\"1c0032\" align=\"left\" width=\"36%\"><b>" . _TEAMNAME . "</b></td>";
$standings = new Standings($lid);
$maxcol = $standings->size();
while (($lheader = $standings->headings())) {
$str .= "<td bgcolor=\"1c0032\" align=\"center\"><b>$lheader</b></td>";
}
if ($disp)
$str .= "<td bgcolor=\"1c0032\"> </td>";
$str .= "</tr>";
$p=1;
$standings->select($did, $sid);
while ($standings->fetchRow()) {
$tid = $standings->tid();
if ($bgcolor=="")
$bgcolor="$color";
else
$bgcolor="";
$str .= "<tr $bgcolor>"
. "<td align=\"right\" width=\"3%\">$p.</td>"
. "<td align=\"left\" nowrap width=\"36%\">";
$str .= getTeamNamewithURL($tid, "modules.php?name=League&file=index&op=team&tid=$tid&sid=$sid&lid=$lid&did=$did") . "</td>";
for ($i=0; $i < $standings->size(); $i++) {
$pos = $standings->position($i);
$value = $standings->fetchRowValue();
if ($pos != "")
$value=$pos;
$str .= "<td nowrap align=\"center\" nowrap>$value</td>";
}
if (isAdminLeague($lid, REMOVE_TEAM) and $disp) {
$str .= "<td><center><a href=\"modules.php?name=League&file=admin&op=del_team&tid=$tid&lid=$lid&did=$did&sid=$sid\" title=\"" . _REMOVE . "\"><img src=\"modules/League/images/remove.gif\" border=\"0\" width=\"11\" height=\"11\"></a></center></td>";
}
$str .= "</tr>";
$p++;
}
$str .= "<br></table><br>";
return $str;
} |
/* broken down into divisions */
| Code: |
function display_division_table($did, $name, $sid, $lid, $disp=1) {
global $bgcolor1, $bgcolor2;
$prefs = getLeaguePrefs($lid);
if ($rowcolor != "")
$color="bgcolor=\"$prefs[rowcolor]\"";
else
$color="";
$standings = new Standings($lid);
$max = $standings->size();
$str = "<table width=\"100%\" cellpadding=\"1\" cellspacing=\"0\" border=\"0\" bgcolor=\"$bgcolor1\">";
$str .= "<tr bgcolor=\"$bgcolor2\"><td colspan=\"" . ($max + 3) . "\"><font class=\"option\"><center>$name<br></font>";
if (isAdminLeague($lid, ADD_TEAM) and $disp) {
$str .= " [ <a href=\"modules.php?name=League&file=admin&op=add_team&did=$did&lid=$lid&sid=$sid\">" . _ADDTEAM . "</a> | <a href=\"modules.php?name=League&file=admin&op=recreate_standings_ok&sid=$sid&lid=$lid\">" . _RECREATESTANDING . "</a> | <a href=\"modules.php?name=League&file=admin&op=recalc_standings&sid=$sid&lid=$lid\">" . _RECALCSTANDING . "</a>] ";
$plugin = new Plugins($lid);
echo $plugin->getLinks(PLUGIN_STANDINGS_DIVISION);
}
$str .= "</center></td></tr>";
$str .= "<tr><td bgcolor=\"1c0032\"</td><td bgcolor=\"1c0032\" align=\"left\" width=\"36%\"><b>" . _TEAMNAME . "</b></td>";
$standings = new Standings($lid);
$maxcol = $standings->size();
while (($lheader = $standings->headings())) {
$str .= "<td bgcolor=\"1c0032\" align=\"center\"><b>$lheader</b></td>";
}
if ($disp)
$str .= "<td bgcolor=\"1c0032\"> </td>";
$str .= "</tr>";
$p=1;
$standings->select($did, $sid);
while ($standings->fetchRow()) {
$tid = $standings->tid();
if ($bgcolor=="")
$bgcolor="$color";
else
$bgcolor="";
$str .= "<tr $bgcolor>"
. "<td align=\"right\" width=\"3%\">$p.</td>"
. "<td align=\"left\" nowrap width=\"36%\">";
$str .= getTeamNamewithURL($tid, "modules.php?name=League&file=index&op=team&tid=$tid&sid=$sid&lid=$lid&did=$did") . "</td>";
for ($i=0; $i < $standings->size(); $i++) {
$pos = $standings->position($i);
$value = $standings->fetchRowValue();
if ($pos != "")
$value=$pos;
$str .= "<td nowrap align=\"center\" nowrap>$value</td>";
}
if (isAdminLeague($lid, REMOVE_TEAM) and $disp) {
$str .= "<td><center><a href=\"modules.php?name=League&file=admin&op=del_team&tid=$tid&lid=$lid&did=$did&sid=$sid\" title=\"" . _REMOVE . "\"><img src=\"modules/League/images/remove.gif\" border=\"0\" width=\"11\" height=\"11\"></a></center></td>";
}
$str .= "</tr>";
$p++;
}
$str .= "<br></table><br>";
return $str;
} |
What I want to have happen is this and I want to start "small". So I'd rather start with a simple PHP page to start off with.
Everyone has a team.
[league_teams]
id name shortname img address1 address2 address3 address4 phone1 phone2 web email created owner defplid uid linkme
The UID matches that of phpNuke_users.
[league_players]
id name name2 uid img address1 address2 address3 address4 phone1 phone2 email dob misc1 misc2 misc3 bio disp
Again the UID matches that of the phpNuke_users.
[league_schedule]
id sid did tid1 tid2 score1 score2 whenisit plid matchreport1 matchreport2
The biggest thing with this table here is two things. One is the tid1 and the other is tid2 followed by the score. Obviously someone "won" the game.
So I guess my first hurdle would be how do I figure out "which team (tid#) won the match? Then, based on tid# and their ID, which team was it? If I had that info, how would I put it in the main hall as that team winning or losing their match? I'm not interested in "how" they won cause that's handled under each season which if they click on their team they can do.
Am I over complicating this process? Reading what I need it sounds so dumb simple. |
| |
|