ondi Posted June 9, 2009 Share Posted June 9, 2009 I have the following code <font face="Arial" size="1"> <?php /* *************************************************************************** * tplSoccerStats * ----------------------------------------------------------------------- * Copyright: TPL Design * email: info@tpl-design.com * www: www.tpl-design.com/tplsoccerstats *************************************************************************** */ session_start(); include('admin/user.php'); $connection = mysql_connect("$host","$user","$password") or die(mysql_error()); mysql_select_db("$txt_db_name",$connection) or die(mysql_error()); if( !isset($_SESSION['getAdditional']) ) $_SESSION['getAdditional'] = 0; if( isset($_GET['additional']) ) $_SESSION['getAdditional'] = $_GET['additional']; // //Haetaan asetukset // $pref = mysql_query("SELECT * FROM tplss_preferences WHERE ID = '0'",$connection) or die(mysql_error()); $pdata = mysql_fetch_array($pref); mysql_free_result($pref); include('preferences.inc'); // //Katsotaan, onko sessiomuuttuvat rekisteröity // if(!session_is_registered('defaultseasonid_tplss') || !session_is_registered('defaultmatchtypeid_tplss') || !session_is_registered('defaultlanguage_tplss')) { $_SESSION['defaultseasonid_tplss'] = $pdata['DefaultSeasonID']; $_SESSION['defaultmatchtypeid_tplss'] = $pdata['DefaultMatchTypeID']; $_SESSION['defaultlanguage_tplss'] = $pdata['DefaultLanguage']; $defaultseasonid = $_SESSION['defaultseasonid_tplss']; $defaultmatchtypeid = $_SESSION['defaultmatchtypeid_tplss']; $defaultlanguage = $_SESSION['defaultlanguage_tplss']; } else { $defaultseasonid = $_SESSION['defaultseasonid_tplss']; $defaultmatchtypeid = $_SESSION['defaultmatchtypeid_tplss']; $defaultlanguage = $_SESSION['defaultlanguage_tplss']; } // //Sisällytetään monikielituki // include('language.inc'); // //Haetaan kaudet ja ottelutyypit valikoita varten // $get_seasons = mysql_query("SELECT * FROM tplss_seasonnames WHERE SeasonPublish = '1' ORDER BY SeasonName DESC",$connection) or die(mysql_error()); $get_types = mysql_query("SELECT * FROM tplss_matchtypes ORDER BY MatchTypeName",$connection) or die(mysql_error()); // //Järjestely kauden nimen mukaan, jos sort-muuttujaa ei ole määritelty // $sort = $_REQUEST['sort']; if(!isset($sort)) { $sort = 'season_name'; } // //Pelaajan tiedot:nimi, numero ja esittely // $id = $_REQUEST['id']; $get_player_info = mysql_query("SELECT CONCAT(P.PlayerFirstName, ' ', P.PlayerLastName) AS name, P.PlayerFirstName AS firstname, P.PlayerLastName AS lastname, P.PlayerID AS id, P.PlayerNumber AS number, P.PlayerDescription AS descr, P.PlayerProfile AS prof, P.PlayerHonours AS hono, T.TransferredReason AS reason, IF(P.PlayerDOB='0000-00-00','',DATE_FORMAT(P.PlayerDOB,'%d/%m/%Y')) AS dob, P.PlayerPOB AS pob, IF(P.PlayerDOD='0000-00-00','',DATE_FORMAT(P.PlayerDOD,'%d/%m/%Y')) AS dod, P.PlayerPOD AS pod, P.PlayerIsManager AS ismanager FROM tplss_players P LEFT OUTER JOIN tplss_transferred T ON T.TransferredPlayerID = P.PlayerID WHERE P.PlayerID = '$id' LIMIT 1",$connection) or die(mysql_error()); $playerdata = mysql_fetch_array($get_player_info); mysql_free_result($get_player_info); ?> <? /* Let check if player is manager and show proper table */ if( $playerdata['ismanager'] ) { ?> <table width="<?= $tb2_width ?>%" cellspacing="1" cellpadding="2" border="0"> <tr> <td align="left" valign="middle" bgcolor="#000033" colspan="6"> <b><font color="#ffffff" size="1"><?php echo "$playerdata[name]'s managerial record" ?></b> </td> </tr> <tr> <td font size="1" align="left" valign="middle" bgcolor="<?php echo $top_bg ?>"> <a href="?sort2=season_name&id=<?php echo $id ?>"><font face="Arial" size="1"><?= $txt_season_short ?></a> </td> <td align="center" valign="middle" bgcolor="<?php echo $top_bg ?>"> <a href="?sort2=games&id=<?php echo $id ?>"><font face="Arial" size="1">Games</a> </td> <td align="center" valign="middle" bgcolor="<?php echo $top_bg ?>"> <a href="?sort2=won&id=<?php echo $id ?>"><font face="Arial" size="1">Won </a> </td> <td font face="Arial" size="1" align="center" valign="middle" bgcolor="<?php echo $top_bg ?>"> <a href="?sort2=draw&id=<?php echo $id ?>"><font face="Arial" size="1">Drawn </a> </td> <td align="center" valign="middle" bgcolor="<?php echo $top_bg ?>"> <a href="?sort2=lost&id=<?php echo $id ?>"><font face="Arial" size="1">Lost </a> </td> <td align="center" valign="middle" bgcolor="<?php echo $top_bg ?>"> <a href="?sort2=winpct&id=<?php echo $id ?>"><font face="Arial" size="1">Win%</a> </td> </tr> <font face="Arial" size="1"> <? $query = " SELECT SE.SeasonName AS season_name, M.MatchSeasonID, COUNT(M.MatchSeasonID) AS games, SUM(IF(M.MatchGoals > M.MatchGoalsOpponent,1,0)) AS won, SUM(IF(M.MatchGoals < M.MatchGoalsOpponent,1,0)) AS lost, SUM(IF(M.MatchGoals = M.MatchGoalsOpponent,1,0)) AS draw, IF( COUNT(M.MatchSeasonID)>0, ROUND( SUM(IF(M.MatchGoals > M.MatchGoalsOpponent,1,0)) / COUNT(M.MatchSeasonID) * 100, 2), 0) AS winpct FROM tplss_matches M, tplss_appearancesmngr A, tplss_players P, tplss_seasonnames SE WHERE M.MatchID = A.AppearanceMatchID AND A.AppearancePlayerID = P.PlayerID AND P.PlayerIsManager = 1 AND P.PlayerID = {$id} AND M.MatchSeasonID = SE.SeasonID GROUP BY M.MatchSeasonID "; $sort = isset($_GET['sort2']) ? $_GET['sort2'] : 'season_name'; if( !in_array($sort,array('season_name','games','won','lost','draw','winpct')) ) $sort = 'season_name'; $query .= " ORDER BY " . $sort . " ASC"; $rst = mysql_query($query); echo mysql_error(); $j=1; $tmp = "<b>%s</b>"; while( $r = mysql_fetch_array($rst) ) { if( ($j++) % 2 == 0) $temp = "$bg1"; else $temp = "$bg2"; echo" <tr> <td align=\"left\" valign=\"middle\" bgcolor=\"$temp\"> {$r[season_name]} </a> </td> <td align=\"center\" valign=\"middle\" font face=\"Arial\" size=\"1\" bgcolor=\"$temp\">"; printf( ($sort == 'games'?$tmp:"%s"), $r['games'] ); echo "</td> <td align=\"center\" valign=\"middle\" bgcolor=\"$temp\">"; printf( ($sort == 'won'?$tmp:"%s"), $r['won'] ); echo "</td> <td align=\"center\" valign=\"middle\" bgcolor=\"$temp\">"; printf( ($sort == 'draw'?$tmp:"%s"), $r['draw'] ); echo "</td> <td align=\"center\" valign=\"middle\" bgcolor=\"$temp\">"; printf( ($sort == 'lost'?$tmp:"%s"), $r['lost'] ); echo "</td> <td align=\"center\" valign=\"middle\" bgcolor=\"$temp\">"; printf( ($sort == 'winpct'?$tmp:"%s"), $r['winpct'] ); echo"</td> </tr> \n"; $games += $r['games']; $won += $r['won']; $draw += $r['draw']; $lost += $r['lost']; } ?> <tr> <td align="left" valign="middle" bgcolor="<?=$top_bg ?>"> <b><font face="Arial" size="1">Total</b> </td> <td align="center" valign="middle" bgcolor="<?=$top_bg ?>"> <b><font face="Arial" size="1"><?= $games?></b> </td> <td align="center" valign="middle" bgcolor="<?=$top_bg ?>"> <b><font face="Arial" size="1"><?= $won?></b> </td> <td align="center" valign="middle" bgcolor="<?=$top_bg ?>"> <b><font face="Arial" size="1"><?= $draw?></b> </td> <td align="center" valign="middle" bgcolor="<?=$top_bg ?>"> <b><font face="Arial" size="1"><?= $lost?></b> </td> <td align="center" valign="middle" bgcolor="<?=$top_bg ?>"> <b><font face="Arial" size="1"><?= sprintf("%.2f", ( $games > 0 ? $won / $games * 100 : 0))?></b> </td> </tr> </table> <br> <br> <? } /* else { // show player stats */ // //TARKASTETAAN OTTELUTYYPPI-DROPIN VAIHTOEHTO // //'Kaikki'-vaihtoehto ei ole valittu, haetaan siis ensimmäiseen iffiin matsintyypin mukaan // if($defaultmatchtypeid != 0) { $get_seasons = mysql_query("SELECT SE.SeasonName AS name, S.SeasonID AS id, COUNT( A.AppearancePlayerID ) AS apps FROM tplss_seasons S, tplss_seasonnames SE LEFT OUTER JOIN tplss_matches M ON M.MatchSeasonID = S.SeasonID AND M.MatchTypeID = '$defaultmatchtypeid' LEFT OUTER JOIN tplss_appearances A ON A.AppearancePlayerID = '$id' AND A.AppearanceSeasonID = S.SeasonID AND A.AppearanceMatchID = M.MatchID WHERE SE.SeasonID = S.SeasonID AND S.SeasonPlayerID = '$id' GROUP BY S.SeasonID ORDER BY name",$connection) or die(mysql_error()); $get_goals = mysql_query("SELECT SE.SeasonName AS name, S.SeasonID AS id, COUNT( G.GoalPlayerID ) AS goals FROM (tplss_seasons S, tplss_seasonnames SE) LEFT OUTER JOIN tplss_matches M ON M.MatchSeasonID = S.SeasonID AND M.MatchTypeID = '$defaultmatchtypeid' LEFT OUTER JOIN tplss_goals G ON G.GoalPlayerID = '$id' AND GoalOwn = '0' AND G.GoalSeasonID = S.SeasonID AND G.GoalMatchID = M.MatchID WHERE SE.SeasonID = S.SeasonID AND S.SeasonPlayerID = '$id' GROUP BY S.SeasonID ORDER BY name",$connection) or die(mysql_error()); $get_ins = mysql_query("SELECT SE.SeasonName AS name, S.SeasonID AS id, COUNT( SU.SubstitutionPlayerIDIn ) AS ins FROM (tplss_seasons S, tplss_seasonnames SE) LEFT OUTER JOIN tplss_matches M ON M.MatchSeasonID = S.SeasonID AND M.MatchTypeID = '$defaultmatchtypeid' LEFT OUTER JOIN tplss_substitutions SU ON SU.SubstitutionPlayerIDIn = '$id' AND SU.SubstitutionSeasonID = S.SeasonID AND SU.SubstitutionMatchID = M.MatchID WHERE SE.SeasonID = S.SeasonID AND S.SeasonPlayerID = '$id' GROUP BY S.SeasonID ORDER BY name",$connection) or die(mysql_error()); $get_yellows = mysql_query("SELECT SE.SeasonName AS name, S.SeasonID AS id, COUNT( Y.YellowCardPlayerID ) AS yellows FROM (tplss_seasons S, tplss_seasonnames SE) LEFT OUTER JOIN tplss_matches M ON M.MatchSeasonID = S.SeasonID AND M.MatchTypeID = '$defaultmatchtypeid' LEFT OUTER JOIN tplss_yellowcards Y ON Y.YellowCardPlayerID = '$id' AND Y.YellowCardSeasonID = S.SeasonID AND Y.YellowCardMatchID = M.MatchID WHERE SE.SeasonID = S.SeasonID AND S.SeasonPlayerID = '$id' GROUP BY S.SeasonID ORDER BY name",$connection) or die(mysql_error()); $get_reds = mysql_query("SELECT SE.SeasonName AS name, S.SeasonID AS id, COUNT( R.RedCardPlayerID ) AS reds FROM (tplss_seasons S, tplss_seasonnames SE) LEFT OUTER JOIN tplss_matches M ON M.MatchSeasonID = S.SeasonID AND M.MatchTypeID = '$defaultmatchtypeid' LEFT OUTER JOIN tplss_redcards R ON R.RedCardPlayerID = '$id' AND R.RedCardSeasonID = S.SeasonID AND R.RedCardMatchID = M.MatchID WHERE SE.SeasonID = S.SeasonID AND S.SeasonPlayerID = '$id' GROUP BY S.SeasonID ORDER BY name",$connection) or die(mysql_error()); } else { $get_seasons = mysql_query("SELECT SE.SeasonName AS name, S.SeasonID AS id, COUNT( A.AppearancePlayerID ) AS apps FROM (tplss_seasons S, tplss_seasonnames SE) LEFT OUTER JOIN tplss_appearances A ON A.AppearancePlayerID = '$id' AND A.AppearanceSeasonID = S.SeasonID WHERE SE.SeasonID = S.SeasonID AND S.SeasonPlayerID = '$id' GROUP BY S.SeasonID ORDER BY name",$connection) or die(mysql_error()); $get_goals = mysql_query("SELECT SE.SeasonName AS name, S.SeasonID AS id, COUNT( G.GoalPlayerID ) AS goals FROM (tplss_seasons S, tplss_seasonnames SE) LEFT OUTER JOIN tplss_goals G ON G.GoalPlayerID = '$id' AND GoalOwn = '0' AND G.GoalSeasonID = S.SeasonID WHERE SE.SeasonID = S.SeasonID AND S.SeasonPlayerID = '$id' GROUP BY S.SeasonID ORDER BY name",$connection) or die(mysql_error()); $get_ins = mysql_query("SELECT SE.SeasonName AS name, S.SeasonID AS id, COUNT( SU.SubstitutionPlayerIDIn ) AS ins FROM (tplss_seasons S, tplss_seasonnames SE) LEFT OUTER JOIN tplss_substitutions SU ON SU.SubstitutionPlayerIDIn = '$id' AND SU.SubstitutionSeasonID = S.SeasonID WHERE SE.SeasonID = S.SeasonID AND S.SeasonPlayerID = '$id' GROUP BY S.SeasonID ORDER BY name",$connection) or die(mysql_error()); $get_yellows = mysql_query("SELECT SE.SeasonName AS name, S.SeasonID AS id, COUNT( Y.YellowCardPlayerID ) AS yellows FROM (tplss_seasons S, tplss_seasonnames SE) LEFT OUTER JOIN tplss_yellowcards Y ON Y.YellowCardPlayerID = '$id' AND Y.YellowCardSeasonID = S.SeasonID WHERE SE.SeasonID = S.SeasonID AND S.SeasonPlayerID = '$id' GROUP BY S.SeasonID ORDER BY name",$connection) or die(mysql_error()); $get_reds = mysql_query("SELECT SE.SeasonName AS name, S.SeasonID AS id, COUNT( R.RedCardPlayerID ) AS reds FROM (tplss_seasons S, tplss_seasonnames SE) LEFT OUTER JOIN tplss_redcards R ON R.RedCardPlayerID = '$id' AND R.RedCardSeasonID = S.SeasonID WHERE SE.SeasonID = S.SeasonID AND S.SeasonPlayerID = '$id' GROUP BY S.SeasonID ORDER BY name",$connection) or die(mysql_error()); } /* Get additional stats */ $where = ""; if( $_SESSION['getAdditional'] == 0 ) $where = " AND PlayerId = 0"; if( $defaultmatchtypeid == 0 ) $query = "SELECT * FROM tplss_additionalstats WHERE PlayerId = $id" . $where; else $query = "SELECT * FROM tplss_additionalstats WHERE PlayerId = $id AND MatchType = $defaultmatchtypeid" . $where; $get_additional = mysql_query($query,$connection) or die(mysql_error()); $get_additional_setup = mysql_query("SELECT IsTotal FROM tplss_additionalstats_setup",$connection) or die(mysql_error()); $additional_setup = mysql_fetch_array( $get_additional_setup ); // //Laitetaan kauden nimi ja avaukset taulukoihin myöhempää lajittelua varten // $i=0; while($data = mysql_fetch_array($get_seasons)) { $season_names[$i] = $data['name']; $season_ids[$i] = $data['id']; $apps[$i] = $data['apps']; $i++; } // //Laitetaan maalit taulukkoon myöhempää lajittelua varten // $i=0; while($data = mysql_fetch_array($get_goals)) { $goals[$i] = $data['goals']; $i++; } // //Laitetaan kentälle tulot taulukkoon myöhempää lajittelua varten // $i=0; while($data = mysql_fetch_array($get_ins)) { $ins[$i] = $data['ins']; $i++; } // //Laitetaan keltaiset taulukkoon myöhempää lajittelua varten // $i=0; while($data = mysql_fetch_array($get_yellows)) { $yellows[$i] = $data['yellows']; $i++; } // //Laitetaan punaiset taulukkoon myöhempää lajittelua varten // $i=0; while($data = mysql_fetch_array($get_reds)) { $reds[$i] = $data['reds']; $i++; } /* additional stats */ $additional_seasons = array(); while($data = mysql_fetch_array($get_additional)) { $season_names[$i] = $data['SeasonName'] . " (" . $data['Team'] . ")"; $apps[$i] = $data['Started']; $goals[$i] = $data['Goals']; $ins[$i] = $data['Sub']; $yellows[$i] = $data['Yellows']; $reds[$i] = $data['Reds']; $additional_seasons[] = $season_names[$i]; $i++; } // //kausien määrä muuttujaan ja vapautetaan muisti // $qty = mysql_num_rows($get_seasons) + mysql_num_rows($get_additional); // //Vapautetaan muisti // mysql_free_result($get_seasons); mysql_free_result($get_yellows); mysql_free_result($get_reds); mysql_free_result($get_goals); mysql_free_result($get_ins); if( $qty ) { ?> <!-- statistiikka taulu --> <table font face="Arial" size="1" width="<?= $tb2_width ?>%" cellspacing="1" cellpadding="2" border="0"> <tr> <td font face="Arial" size="1" align="left" valign="middle" bgcolor="#000033" colspan="6"> <b><font color="#ffffff" font face="Arial" size="1"><?php echo "$playerdata[name]'s playing record" ?></b> </td> </tr> <tr> <td align="left" valign="middle" bgcolor="<?php echo $top_bg ?>"> <a href="?sort=season_name&id=<?php echo $id ?>"><font face="Arial" size="1"><?= $txt_season_short ?></a> </td> <td align="center" valign="middle" bgcolor="<?php echo $top_bg ?>"> <a href="?sort=apps&id=<?php echo $id ?>"><font face="Arial" size="1"><?= $txt_openings_short ?></a> </td> <td align="center" valign="middle" bgcolor="<?php echo $top_bg ?>"> <a href="?sort=ins&id=<?php echo $id ?>"><font face="Arial" size="1"><?= $txt_to_the_field_short ?></a> </td> <td align="center" valign="middle" bgcolor="<?php echo $top_bg ?>"> <a href="?sort=goals&id=<?php echo $id ?>"><font face="Arial" size="1"><?= $txt_goals_short ?></a> </td> <td align="center" valign="middle" bgcolor="<?php echo $top_bg ?>"> <a href="?sort=yellows&id=<?php echo $id ?>"><font face="Arial" size="1"><?= $txt_yellow_cards_short ?></a> </td> <td align="center" valign="middle" bgcolor="<?php echo $top_bg ?>"> <a href="?sort=reds&id=<?php echo $id ?>"><font face="Arial" size="1"><?= $txt_red_cards_short ?></a> </td> </tr> <?php // //Järjestellään multisortin avulla // switch($sort) { case 'season_name': array_multisort($season_names, SORT_ASC, SORT_STRING, $goals, $apps, $yellows, $reds, $ins); break; case 'apps': array_multisort($apps, SORT_DESC, SORT_NUMERIC, $season_names, SORT_ASC, SORT_STRING, $goals, $yellows, $reds, $ins); break; case 'ins': array_multisort($ins, SORT_DESC, SORT_NUMERIC, $season_names, SORT_ASC, SORT_STRING, $apps, $goals, $yellows, $reds); break; case 'goals': array_multisort($goals, SORT_DESC, SORT_NUMERIC, $season_names, SORT_ASC, SORT_STRING, $apps, $yellows, $reds, $ins); break; case 'yellows': array_multisort($yellows, SORT_DESC, SORT_NUMERIC, $season_names, SORT_ASC, SORT_STRING, $goals, $apps, $reds, $ins); break; case 'reds': array_multisort($reds, SORT_DESC, SORT_NUMERIC, $season_names, SORT_ASC, SORT_STRING, $goals, $apps, $yellows, $ins); break; } // //Annetaan alkuatrvot yhteensä-muuttujille // $total_apps = 0; $total_ins = 0; $total_goals = 0; $total_yellows = 0; $total_reds = 0; // //Tulostetaan tilastot // $i=0; $j=1; while($i < $qty) { // //Tarkastetaan jakojäännöksellä, kumpi väreistä valitaan solun taustaksi // if($j % 2 == 0) $temp = "$bg1"; else $temp = "$bg2"; echo" <tr> <td align=\"left\" valign=\"middle\" bgcolor=\"$temp\"> <a href=\"player2.php?id={$id}&season={$season_ids[$i]}\"> $season_names[$i] </a> </td> <td align=\"center\" valign=\"middle\" bgcolor=\"$temp\">"; // //Vahvennetaan tilasto tietyn ominaisuuden kohdalta // if($sort == 'apps') echo'<b>'; echo"$apps[$i]"; if($sort == 'apps') echo'</b>'; echo"</td> <td align=\"center\" valign=\"middle\" bgcolor=\"$temp\">"; if($sort == 'ins') echo'<b>'; echo"$ins[$i]"; if($sort == 'ins') echo'</b>'; echo"</td> <td align=\"center\" valign=\"middle\" bgcolor=\"$temp\">"; if($sort == 'goals') echo'<b>'; echo"$goals[$i]"; if($sort == 'goals') echo'</b>'; echo"</td> <td align=\"center\" valign=\"middle\" bgcolor=\"$temp\">"; if($sort == 'yellows') echo'<b>'; echo"$yellows[$i]"; if($sort == 'yellows') echo'</b>'; echo"</td> <td align=\"center\" valign=\"middle\" bgcolor=\"$temp\">"; if($sort == 'reds') echo'<b>'; echo"$reds[$i]"; if($sort == 'reds') echo'</b>'; echo"</td> </tr> \n"; // //Kasvatetaan yhteensä-muuttujien arvoa // //if( !in_array($season_names[$i],$additional_seasons) // || (in_array($season_names[$i],$additional_seasons) && $additional_setup[0] != 0 ) ) //{ $total_apps = $total_apps + $apps[$i]; $total_goals = $total_goals + $goals[$i]; $total_ins = $total_ins + $ins[$i]; $total_yellows = $total_yellows + $yellows[$i]; $total_reds = $total_reds + $reds[$i]; //} $i++; $j++; } ?> <tr> <td align="left" valign="middle" bgcolor="<?php echo $top_bg ?>"> <b><font face="Arial" size="1"><?= $txt_total ?></b> </td> <td font face="Arial" size="1" align="center" valign="middle" bgcolor="<?php echo $top_bg ?>"> <font face="Arial" size="1"> <?php echo "<b>$total_apps</b>"; ?> </td> <td align="center" valign="middle" bgcolor="<?php echo $top_bg ?>"> <font face="Arial" size="1"> <?php echo "<b>$total_ins</b>"; ?> </td> <td align="center" valign="middle" bgcolor="<?php echo $top_bg ?>"> <font face="Arial" size="1"> <?php echo "<b>$total_goals</b>"; ?> </td> <td align="center" valign="middle" bgcolor="<?php echo $top_bg ?>"> <font face="Arial" size="1"> <?php echo "<b>$total_yellows</b>"; ?> </td> <td align="center" valign="middle" bgcolor="<?php echo $top_bg ?>"> <font face="Arial" size="1"> <?php echo "<b>$total_reds</b>"; ?> </td> </tr> <tr><font face="Arial" size="1"> <td align="center" valign="middle" colspan="6" bgcolor="<?php echo $top_bg ?>"> <a href="?sort=season_name&id=<?php echo $id ?>"><font face="Arial" size="1"> <?= $txt_by_season ?></a> | <a href="?sort=apps&id=<?php echo $id ?>"><font face="Arial" size="1"> <?= $txt_in_opening ?></a> | <a href="?sort=ins&id=<?php echo $id ?>"><font face="Arial" size="1"> <?= $txt_substituted ?></a> | <a href="?sort=goals&id=<?php echo $id ?>"><font face="Arial" size="1"> <?= $txt_goals_long ?></a> | <a href="?sort=yellows&id=<?php echo $id ?>"><font face="Arial" size="1"> <?= $txt_yellow_cards_long ?></a> | <a href="?sort=reds&id=<?php echo $id ?>"><font face="Arial" size="1"> <?= $txt_red_cards_long ?></a> </td> </tr> </table> <?php } // //Haetaan viimeiset pelit, missä pelaaja on esiintynyt avauksessa // // Full debut switch($print_date) { case 1: { $how_to_print = "%d.%m.%Y $txt_at %H:%i"; } break; case 2: { $how_to_print = "%m.%d.%Y $txt_at %H:%i"; } break; case 3: { $how_to_print = "%b %D %Y $txt_at %H:%i"; } break; } $query = mysql_query(" SELECT M.MatchID AS id, M.MatchGoals AS goals, M.MatchGoalsOpponent AS goals_opponent, M.MatchPublish AS publish, DATE_FORMAT(M.MatchDateTime, '$how_to_print') AS time, MT.MatchTypeName AS type, M.MatchAdditionalType AS add_type, O.OpponentName AS opponent, O.OpponentID AS oppid, M.MatchPlaceID AS place, M.MatchNeutral AS neutral FROM ( tplss_matches M, tplss_matchtypes MT, tplss_appearances A, tplss_opponents O ) WHERE M.MatchTypeID = MT.MatchTypeID AND M.MatchID = A.AppearanceMatchID AND A.AppearancePlayerID = '$id' AND M.MatchOpponent = O.OpponentID ORDER BY M.MatchDateTime LIMIT 1 ",$connection) or die(mysql_error()); if( mysql_num_rows($query) ) { ?> <br><br> <table width="<?= $tb2_width ?>%" cellspacing="1" cellpadding="2" border="0"> <tr> <td align="left" valign="middle" bgcolor="#000033" colspan="5"> <b><font color="#ffffff" font face="Arial" size="1" ><?php echo "$playerdata[name]'s full debut" ?></b> </td> </tr> <?php // //Tarkistetaan, miten printataan päivämäärä // // //Onko yhtään? // /* if(mysql_num_rows($query) == 0) { echo"<td align=\"left\" valign=\"middle\" bgcolor=\"$bg2\" colspan=\"5\"> $txt_none </td>"; } else { */ $j=1; while($data = mysql_fetch_array($query)) { // //Tarkastetaan jakojäännöksellä, kumpi väreistä valitaan solun taustaksi // if($j % 2 == 0) $temp = "$bg1"; else $temp = "$bg2"; echo"<tr> <td align=\"left\" valign=\"middle\" bgcolor=\"$temp\"> $data[time] </td> <td align=\"center\" valign=\"middle\" bgcolor=\"$temp\">"; if($data['add_type'] == '') { echo"$data[type]"; } else { echo"$data[type] / $data[add_type]"; } echo"</td> <td align=\"center\" valign=\"middle\" bgcolor=\"$temp\">"; // //Tarkastetaan onko kyseessä koti, vieras vai puolueeton // if($data['neutral'] == 1) { echo"$txt_neutral_short"; } else { if($data['place'] == 1) { echo"$txt_home_short"; } elseif($data['place'] == 2) { echo"$txt_away_short"; } } echo"</td> <td align=\"center\" valign=\"middle\" bgcolor=\"$temp\"> <a href=\"opponent.php?opp=$data[oppid]\">$data[opponent]</a> </td> <td align=\"center\" valign=\"middle\" bgcolor=\"$temp\">"; if($data['goals'] == NULL || $data['goals_opponent'] == NULL) { echo" "; } else { // //Tarkistetaan, onko peli julkaistu // if($data['publish'] == 1) echo"<a href=\"matchdetails.php?id=$data[id]\">$data[goals] - $data[goals_opponent]</a>"; else echo"$data[goals] - $data[goals_opponent]"; } echo'</td> </tr>'; $j++; } //} mysql_free_result($query); ?> </table> <? } // full debut // //Haetaan viimeiset pelit, missä pelaaja on esiintynyt avauksessa // // Latest matches $query = mysql_query(" SELECT M.MatchID AS id, M.MatchGoals AS goals, M.MatchGoalsOpponent AS goals_opponent, M.MatchPublish AS publish, DATE_FORMAT(M.MatchDateTime, '$how_to_print') AS time, MT.MatchTypeName AS type, M.MatchAdditionalType AS add_type, O.OpponentName AS opponent, O.OpponentID AS oppid, M.MatchPlaceID AS place, M.MatchNeutral AS neutral FROM ( tplss_matches M, tplss_matchtypes MT, tplss_appearances A, tplss_opponents O ) WHERE M.MatchTypeID = MT.MatchTypeID AND M.MatchID = A.AppearanceMatchID AND A.AppearancePlayerID = '$id' AND M.MatchOpponent = O.OpponentID ORDER BY M.MatchDateTime DESC LIMIT 5 ",$connection) or die(mysql_error()); if( mysql_num_rows($query) ) { ?> <br><br> <table width="<?= $tb2_width ?>%" cellspacing="1" cellpadding="2" border="0"> <tr> <td align="left" valign="middle" bgcolor="#000033" colspan="5"> <b><font color="#ffffff"><?= $txt_latest_appearances ?><?php echo "$playerdata[name] started" ?></b> </td> </tr> <?php // //Tarkistetaan, miten printataan päivämäärä // switch($print_date) { case 1: { $how_to_print = "%d.%m.%Y $txt_at %H:%i"; } break; case 2: { $how_to_print = "%m.%d.%Y $txt_at %H:%i"; } break; case 3: { $how_to_print = "%b %D %Y $txt_at %H:%i"; } break; } // //Onko yhtään? // /* if(mysql_num_rows($query) == 0) { echo"<td align=\"left\" valign=\"middle\" bgcolor=\"$bg2\" colspan=\"5\"> $txt_none </td>"; } else { */ $j=1; while($data = mysql_fetch_array($query)) { // //Tarkastetaan jakojäännöksellä, kumpi väreistä valitaan solun taustaksi // if($j % 2 == 0) $temp = "$bg1"; else $temp = "$bg2"; echo"<tr> <td align=\"left\" valign=\"middle\" bgcolor=\"$temp\"> $data[time] </td> <td align=\"center\" valign=\"middle\" bgcolor=\"$temp\">"; if($data['add_type'] == '') { echo"$data[type]"; } else { echo"$data[type] / $data[add_type]"; } echo"</td> <td align=\"center\" valign=\"middle\" bgcolor=\"$temp\">"; // //Tarkastetaan onko kyseessä koti, vieras vai puolueeton // if($data['neutral'] == 1) { echo"$txt_neutral_short"; } else { if($data['place'] == 1) { echo"$txt_home_short"; } elseif($data['place'] == 2) { echo"$txt_away_short"; } } echo"</td> <td align=\"center\" valign=\"middle\" bgcolor=\"$temp\"> <a href=\"opponent.php?opp=$data[oppid]\">$data[opponent]</a> </td> <td align=\"center\" valign=\"middle\" bgcolor=\"$temp\">"; if($data['goals'] == NULL || $data['goals_opponent'] == NULL) { echo" "; } else { // //Tarkistetaan, onko peli julkaistu // if($data['publish'] == 1) echo"<a href=\"matchdetails.php?id=$data[id]\">$data[goals] - $data[goals_opponent]</a>"; else echo"$data[goals] - $data[goals_opponent]"; } echo'</td> </tr>'; $j++; } //} mysql_free_result($query); ?> </table> <? } // //Haetaan viimeiset pelit, missä pelaaja on tehnyt maalin //latest matches scored $query = mysql_query(" SELECT DISTINCT M.MatchID AS id, M.MatchGoals AS goals, M.MatchPublish AS publish, M.MatchGoalsOpponent AS goals_opponent, DATE_FORMAT(M.MatchDateTime, '$how_to_print') AS time, MT.MatchTypeName AS type, M.MatchAdditionalType AS add_type, O.OpponentName AS opponent, O.OpponentID AS oppid, M.MatchPlaceID AS place, M.MatchNeutral AS neutral FROM ( tplss_matches M, tplss_matchtypes MT, tplss_goals G, tplss_opponents O ) WHERE M.MatchTypeID = MT.MatchTypeID AND M.MatchID = G.GoalMatchID AND G.GoalPlayerID = '$id' AND G.GoalOwn = '0' AND M.MatchOpponent = O.OpponentID ORDER BY M.MatchDateTime DESC LIMIT 5 ",$connection) or die(mysql_error()); if( mysql_num_rows($query) ) { ?> <br><br> <table width="<?= $tb2_width ?>%" cellspacing="1" cellpadding="2" border="0"> <tr> <td align="left" valign="middle" bgcolor="#000033" colspan="5"> <b><font color="#ffffff"><?= $txt_latest_goals ?><?php echo "$playerdata[name] scored" ?></b> </td> </tr> <?php // //Tarkastetaan löytyykö yhtään // /* if(mysql_num_rows($query) == 0) { echo"<td align=\"left\" valign=\"middle\" bgcolor=\"$bg2\" colspan=\"5\"> $txt_none </td>"; } else { */ $j=1; while($data = mysql_fetch_array($query)) { // //Tarkastetaan jakojäännöksellä, kumpi väreistä valitaan solun taustaksi // if($j % 2 == 0) $temp = "$bg1"; else $temp = "$bg2"; echo"<tr> <td align=\"left\" valign=\"middle\" bgcolor=\"$temp\"> $data[time] </td> <td align=\"center\" valign=\"middle\" bgcolor=\"$temp\">"; if($data['add_type'] == '') { echo"$data[type]"; } else { echo"$data[type] / $data[add_type]"; } echo"</td> <td align=\"center\" valign=\"middle\" bgcolor=\"$temp\">"; // //Tarkastetaan onko kyseessä koti, vieras vai puolueeton // if($data['neutral'] == 1) { echo"$txt_neutral_short"; } else { if($data['place'] == 1) { echo"$txt_home_short"; } elseif($data['place'] == 2) { echo"$txt_away_short"; } } echo"</td> <td align=\"center\" valign=\"middle\" bgcolor=\"$temp\"> <a href=\"opponent.php?opp=$data[oppid]\">$data[opponent]</a> </td> <td align=\"center\" valign=\"middle\" bgcolor=\"$temp\">"; if($data['goals'] == NULL || $data['goals_opponent'] == NULL) { echo" "; } else { // //Tarkistetaan, onko peli julkaistu // if($data['publish'] == 1) echo"<a href=\"matchdetails.php?id=$data[id]\">$data[goals] - $data[goals_opponent]</a>"; else echo"$data[goals] - $data[goals_opponent]"; } echo'</td> </tr>'; $j++; } //} mysql_free_result($query); ?> </table> <? } //} // show player stats ?> </td> </tr> </table> </td> </tr> </table> <?php include('bottom.txt'); ?> </form> And as you can see here: http://www.walthamforest-fc.co.uk/stats/penpicplayer.php?id=410 Some of my text is different sizes. How can I make it so the entire file is the same text size? Thanks Quote Link to comment Share on other sites More sharing options...
scvinodkumar Posted June 9, 2009 Share Posted June 9, 2009 add a style for body in the head tag <style> body { font-family:Arial, Helvetica, sans-serif; font-size:12px; font-style:normal; line-height:12px; } </style> Quote Link to comment Share on other sites More sharing options...
Psycho Posted June 9, 2009 Share Posted June 9, 2009 You have tables. Styles applied to the BODY element do not apply to table content. You need to add the TD element as well. Try this: <style> body, td { font-family:Arial, Helvetica, sans-serif; font-size:12px; font-style:normal; line-height:12px; } </style> EDIT: OK, that may not work. You are using depricated and invalid code. Do NOT use the FONT tag, it has been deprecated for some time. Also, this is not even valid <td font face="Arial" size="1" align="center" valign="middle" bgcolor="cccccc"> I would suggest removing all the in-line formatting using antiquated code and instead using CSS (i.e. styles) as suggested above. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.