hey all, this is the same code as before, but stuff taken out.
my database has a section for players, players_stats, schedule_scores, teams, divisions, seasons, and a few more for announcements and so on
the players section has his id, last name, first name and all info related to a player
the player stats has his stats, game_id, team id and any trackable stats
the schedule scores has the game_id, team id and any stats in making a score sheet.
these are the 3 sections I am using to try and pull, the last name of a player for scoring a goal for certain game Id's.
The code below is only partial code.. it is used in my boxscore section after a game is updated and so fourth. Weather this code will work for gathering what i need is beyond me, but i figured since this code worked to gather the info for a game it should work for what i need it to do.
thanks
<?
include("../../../config.php");
$open = mysql_connect($hostname,$user,$password);
mysql_select_db("$db",$open);
?>
<html>
<head>
<title>Game Details / Stats</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="../../../includes/leaguestyle.css">
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function printWindow() {
bV = parseInt(navigator.appVersion);
if (bV >= 4) window.print();
}
// End -->
</script>
</head>
<?
//VARIABLES PASSED
$thisdiv = $tdiv;
//GET DIVISION NAME
$result_dn = mysql_query("SELECT id,name FROM divisions WHERE id = '".$thisdiv."'");
$thisdiv_name = mysql_result($result_dn,0,"name");
//GAME INFORMATION
$result_gm = mysql_query("SELECT * FROM schedule_scores WHERE id = '".$id."'");
$gm_date = mysql_result($result_gm,0,"date");
$gm_time = mysql_result($result_gm,0,"time");
$gm_loc = mysql_result($result_gm,0,"location");
$gm_ot = mysql_result($result_gm,0,"ot_game");
$adate = explode("-",$gm_date);
$ndate = date ("D - M d Y", mktime (0,0,0,$adate[1],$adate[2],$adate[0]));
$gm_team1 = mysql_result($result_gm,0,"team1");
if(eregi("l-",$gm_team1)) {
$gm_team1 = eregi_replace("l-","",$gm_team1);
$result_t1 = mysql_query("SELECT * FROM locations WHERE id = '".$gm_team1."'");
$t1_name = mysql_result($result_t1,0,"name");
} else {
$result_t1 = mysql_query("SELECT * FROM teams WHERE id = '".$gm_team1."'");
$t1_name = mysql_result($result_t1,0,"name");
}
$gm_team2 = mysql_result($result_gm,0,"team2");
if(eregi("l-",$gm_team2)) {
$gm_team2 = eregi_replace("l-","",$gm_team2);
$result_t2 = mysql_query("SELECT * FROM locations WHERE id = '".$gm_team2."'");
$t2_name = mysql_result($result_t2,0,"name");
} else {
$result_t2 = mysql_query("SELECT * FROM teams WHERE id = '".$gm_team2."'");
$t2_name = mysql_result($result_t2,0,"name");
}
//PLAYER STATS FOR VISITOR TEAM
$result_pi = mysql_query("SELECT * FROM players WHERE teamid = '".$gm_team2."' AND position != 'G' and status = 'Healthy' AND registered = '1' ORDER BY lname");
$total_pi = mysql_numrows($result_pi);
$i = 0;
while($i < $total_pi) {
//ROW COLOR
$tbgcolor = is_int($i / 2)?"#efefef":"#ffffff";
$pid = mysql_result($result_pi,$i,"id");
//GET STAT INFO
$result_ps = mysql_query("SELECT * FROM player_stats WHERE playerid = '".$pid."' AND game_id = '".$id."'");
$total_ps = mysql_numrows($result_ps);
if($total_ps > 0) {
$goals = mysql_result($result_ps,0,"goals");
} else {
$goals = "0";
}
$stats .= "
<tr bgcolor=\"".$tbgcolor."\" align=\"center\">
<td class=\"table_text\">"
.mysql_result($result_pi,$i,"fname")." ".mysql_result($result_pi,$i,"lname")."
(".mysql_result($result_pi,$i,"position").")</td>
<td class=\"table_text\">$goals</td> ";
$i++;
unset($result_ps);
}
echo $stats;
?>
</body>
</html>