I believe this is the right area for this. I was told to come here from c/c++ forums. Said you guys would be better suited for this:
I run a madden league and we use a stat tool that takes stats and puts them into html pages. First question is this. We have this php file that takes rosters info and puts out a salary cap info page. That shows how many players the team has, the amount the team has spent, what is left to spend, and how much the person went over as well. But this isnt working correctly. The only things working are the amount of players, and amount spent. I believe the math is wrong, could someone please help me with this. I bought the the tool and have no idea how php works. Here is the file and what is says:
// CONNECT TO DATABASE
$db = @mysql_connect($host,$user,$password) or die("<html><body bgcolor=$bgcolor>User Error!</body></html>");
@mysql_select_db($database,$db) or die("<html><body bgcolor=$bgcolor>Database Error!</body></html>");
$mysql_query = "SELECT max(season) as season FROM game_summary WHERE league_id=$league_id";
$res=mysql_query($mysql_query,$db);
$season = mysql_result($res,0,"season");
$mysql_query = "SELECT salary_cap FROM league where id=1";
$res=mysql_query($mysql_query,$db);
$salary_cap = mysql_result($res,0,"salary_cap")/1000;
// GET THE CURRENT WEEK FOR THE SPECIFIED LEAGUE
$mysql_query = "SELECT nick_name as team,
sum(sal) as spent,
sum(1) as tot_players,
cap_penalty FROM team_players, team
WHERE team.team_abbr=team_players.team
and team.league_id=team_players.league_id
and team.league_id=1
and season=$season
GROUP BY team ORDER BY team";
$res=mysql_query($mysql_query,$db);
$num_rows = mysql_num_rows($res);
$captmp = "\$76.7" . $salary_cap/1000 . "M";
echo "<center><font size=4 color=000000 face=verdana>
<b>Salary Cap Totals ($captmp / 53 Players)</b><br><br></font>
<table cellpadding=1 cellspacing=1 border=0 bgcolor=000000>
<tr><td><table bgcolor=FFFFF cellpadding=2 cellspacing=0 border=0F>";
echo "<tr bgcolor=000000>
<td width=75><font size=1 color=FFFFFF face=verdana>Team</td>
<td width=50><font size=1 color=FFFFFF face=verdana>Players</td>
<td align=right width=75><font size=1 color=FFFFFF face=verdana>Used</td>
<td align=right width=75><font size=1 color=FFFFFF face=verdana></td>
<td align=right width=75><font size=1 color=FFFFFF face=verdana>Available</td>
</tr>";
$rotate[0]="cecece";
$rotate[1]="FFFFFF";
for($count=0;$count<$num_rows;$count++){
$team = mysql_result($res,$count,"team");
$tot_players = mysql_result($res,$count,"tot_players");
$spent = mysql_result($res,$count,"spent")/1000;
$left = $salary_cap - $spent;
if($spent<1000) $spent = "\$" . $spent . "K";
else $spent = "\$" . $spent/1000 . "M";
$cur_color=$rotate[$count%2];
if($left<1000 & $left>1) $left = "\$" . $spent . "K";
elseif($left<1000){
$cur_color="red";
if($left>-1000) $left = "\$" . $spent . "K";
else $left = "\$" . $left/1000 . "M";
}
else $left = "\$" . $left/1000 . "M";
echo "<tr bgcolor=$cur_color>
<td><font size=1 face=verdana>$team</td>
<td><font size=1 face=verdana>$tot_players</td>
<td align=right><font size=1 face=verdana>$spent</font></td>
<td align=right><font size=1 face=verdana>$penalty</font></td>
<td align=right><font size=1 face=verdana>$left</font></td>
</tr>";
}
echo "</table></td></tr></table><center><br>";
any help would be greatly appreciated! Thanks
if you want to see what I am talking about go here:
http://www.putm.wired-hub.net/league/gm/salarycap.php?league_id=1&season=2002
Also in some areas of this I get that error at the top of the pages. Something like unable to jump from 0. I bought the program that does this so I am no help here. Any help would be greatly appreciated. Thanks