{source}
<?php
// enter the host name of your database server
$host = “localhost”;
//enter the user that has access to administer this server
$dbUser = “wwwwalk_pbsadmin”;
//enter the password for this user
$dbPassword = “pbspassword54075”;
//enter the name of the database that you’ll be using
$dbName = “wwwwalk_pbstest”;
//enter your team name to be displayed at the top of the main page
$teamname = “”;
//enter the full path to the home page for your team i.e – http://www.myteamsite.com
$teamhomepage = “”;
//enter the number of innings your team plays in a regular game. This is required to calculate
//the correct earned run average for pitchers
//ERA = # of earned runs * inningsplayed / innings pitched
$inningsplayed = “9”;
//These are the sort options. $bsort is the batting stats sort and $psort is the pitching stats sort.
//The default sort for batting is “avg” (batting average) and for pitching is “era” (earned run average)
//If you would like to change the sort, you need to specify the stat. The EXACT name from the following key must be entered
//for this sort to work:
//KEY:
/* BATTING: PITCHING:
“bb” => Walks “bb” => Walks
“runs” => Runs scored “runs” => Runs scored
“singles” => Singles “er” => Earned runs
“doubles” => Doubles “gs” => Games started
“triples” => Triples “hr” => Homers
“hr” => Homers “sos” => Strike out swinging
“rbi” => Runs batted in “sol” => Strike out looking
“sos” => Strike out swinging “hp” => Hit by pitch
“sol” => Strike out looking “win” => Wins
“hp” => Hit by pitch “loss” => Losses
“obe” => On by error “save” => Saves
“sb” => Stolen bases “nd” => No decisions
“sac” => Sacrifice “games” => Games pitched in
“ab” => At bats “ip” => Innings pitched
“hits” => Hits “shut” => Shut outs
“so” => Total strike outs “so” => Strike outs
“obp” => On base percentage “kpergame” => Strike outs per game
“avg” => Batting average “wpergame” => Walks per game
“slg” => Slugging percentage “era” => Earned run average */
$bsort = “avg”;
$psort = “era”;
//enter a “1” if you want to display a stats key at the bottom of the page
$showkey = “0”;
$db = mysql_connect($host, $dbUser,$dbPassword) or die ( ‘Unable to connect to server.’ );;
mysql_select_db($dbName,$db) or die ( ‘Unable to select database.’ );
?>
<?php mb_http_input(“iso-8859-1”);
mb_http_output(“iso-8859-1”);?>
<html>
<head>
<title>Posiciones – Peloteros del sur</title>
<meta name=”description” content=”posiciones” />
<style type=”text/css”>
<!–
.style1 {color: #FFFFFF}
–>
</style>
</head>
<body marginheight=”0″ marginwidth=”10″ topmargin=”0″ leftmargin=”10″ bgcolor=”#ffffff”>
<div align=”center”>
<table width=”534″ border=”0″ cellspacing=”0″ cellpadding=”0″>
<tr>
<td width=”800″ valign=”top”>
<table width=”100%” border=”0″ cellspacing=”0″ cellpadding=”0″>
<tr>
<td>
<?
$menu = & JSite::getMenu();
$item = $menu->getActive();
$id=$item->itemid; ?>
<h1 >2009 Posiciones </h1>
<table width=”100%” border=”0″ cellspacing=”0″ cellpadding=”0″>
<tr>
<td height=”7″><spacer type=”block” width=”1″ height=”1″></td>
</tr>
<tr>
<td height=”7″><spacer type=”block” width=”1″ height=”1″></td>
</tr>
</table>
</td>
<td align=”right” nowrap>
</td>
</tr>
</table>
<table width=”100%” border=”0″ cellspacing=”0″ cellpadding=”2″>
<tr bgcolor=”#CCCCCC” >
<td height=”18″ colspan=”12″ ><strong>Liga del Sur </strong></td>
</tr>
<tr align=”right” bgcolor=”#990033″>
<td width=”9%” ><span class=”style1″>Logo</span></td>
<td width=”22%” height=”18″ align=”left”><span class=”style1″> Equipos</span></td>
<td width=”5%” ><span class=”style1″>W</span></td>
<td width=”5%” ><span class=”style1″>L</span></td>
<td width=”7%” ><span class=”style1″>Pct</span></td>
<td width=”7%” ><span class=”style1″>GB</span></td>
<td width=”7%” ><span class=”style1″>Local</span></td>
<td width=”7%” ><span class=”style1″>Visitante</span></td>
<td width=”8%” ><span class=”style1″>L5</span></td>
</tr>
<?php
/* $team_arr = mysql_query(“SELECT * FROM playersinseason “,$db); (Wins/(Wins+Losts)) AS pct ORDER BY pct DESC
$team_arr_lis = mysql_fetch_array($team_arr); */
$sql_posicion_sort = “SELECT sum(win) AS Wins ,sum(lost) AS Losts,teamID, (sum(win)-sum(lost)) AS DL FROM gamesscorecard WHERE seasonID=1 AND league=2 GROUP BY teamID ORDER BY DL DESC”;
$posicion_sort = mysql_query($sql_posicion_sort);
$gmsRow = mysql_fetch_array($posicion_sort);
$result = mysql_num_rows($posicion_sort);
$i=1;
do {
$gm_teams_arr = mysql_query(“SELECT club_medio FROM team WHERE team.teamID=$gmsRow[teamID]”,$db);
$local_d = mysql_fetch_array($gm_teams_arr);
$local[$i] = $local_d[club_medio];
echo ‘<tr align=”right”>’;
echo ‘<td align=”left”><a href=”/mlb/team?statsId=10″><img src=”” width=”20″ height=”18″ hspace=”10″ border=”0″></a></td>’;
echo ‘<td align=”left”> -<a href=”” >’;
echo $local[$i];
echo ‘</a></td>’;
$pct= $gmsRow[Wins]/($gmsRow[Wins]+$gmsRow[Losts]);
echo ‘ <td>’.$gmsRow[Wins].'</td>’;
echo ‘ <td>’.$gmsRow[Losts].'</td>’;
echo ‘ <td>’.$pct.'</td>’;
$lider[$i] = $gmsRow[Wins];
$atras[$i] = $gmsRow[Losts];
if ($i == 1)
{ echo ‘ <td> — </td>’;}
else {
$gb = (($lider[1] – $lider[$i]) + ($atras[$i] – $atras[1])) / 2;
echo ‘ <td> ‘.$gb.’ </td>’;
}
echo ‘ <td> – </td>’;
echo ‘ <td> – </td>’;
echo ‘ <td> – </td>’;
echo ‘ </tr>’;
$i++;} while ($gmsRow = mysql_fetch_array($posicion_sort))
?>
<tr>
<td colspan=”12″ height=”18″><spacer type=”block” width=”1″ height=”1″></td>
</tr>
<tr>
<td colspan=”12″>
<table width=”100%” cellpadding=”1″ cellspacing=”0″ border=”0″ >
<tr>
<td><table width=”100%” cellpadding=”4″ cellspacing=”0″ border=”0″ >
<tr>
<td ><b>datos</b></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td height=”7″ colspan=”12″><spacer type=”block” width=”1″ height=”1″></td>
</tr>
</table>
</td>
</tr>
</table>
{/source}