Jump to content

php coding displaying sports stats


vegasscorp

Recommended Posts

I have a high school sports site for basketball.

I would like to display stats and totals. I have created the data base with three tables Players,games,stats. the bulk of the stats are entered in the stats table.

The stats table is like this.
id | pid | gid | pts | thr | rbs | blks | ast | etc.
1----10-----1----19-----2-----2-----3-----3----etc.
2-----5-----1----9------0-----1-----1-----1----etc.
3-----7-----1----5------1-----0-----2-----6----etc.
4----10-----2----12-----1-----2-----4-----2----etc.

The Id is unique but the pid and gid are unique for players and games.

All I need to do is display the sum of all unique gid on each line on one stats page. Then for each players page display the sum for unique gid on each line for that certain pid (player).
I need help on the php code to use to display results.

Is this what I put on page? I get error at line starting with $number

this is what's in header?
<?php
$query = "SELECT gid FROM table_name GROUP BY gid LIMIT $start, $length";
//query database
$number = mysql_num_rows($result);
?>

This is what's in body?

<?php echo $number['Pts'];?>


Please help. much gratitude
Link to comment
https://forums.phpfreaks.com/topic/32419-php-coding-displaying-sports-stats/
Share on other sites

So far I have this? But don't know where this goes on top of page or in body of page???

<?php
mysql_select_db($database_Connection, $Connection);
$query = "SELECT gid FROM stats GROUP BY gid"; //try this at first without the limit
$result = mysql_query($query,$link);
$number = mysql_num_rows($result);
echo 'Number of games played: '.$number;
$query = "SELECT pid,COUNT(gid) AS CTgid FROM stats GROUP BY pid LIMIT $start, $length"
$result = mysql_query($query,$link);
while($row = mysql_fetch_array($result)) {
echo 'Player ID: '.$row['pid'].'<br/>';
echo 'Number of games: '.$row['CTgid'].'<br/><br/>';
?>

If this goes on top of page. What goes in <body> </body> to display results. Thankyou for any help I don't do this as carrer just volunteered for high school basketball team.

http://www.vpbasketball.net/varsity/bac/team.php

the link above shows what looked like last season. The difference last season was I made a table for each player and all I did in Dreamweaver mx 2004 was just use the echo command to display in result in body. It was suggested that I not make so many tables and just make three tables. Games,Players, and Stats. All the stats go into stats table.


I want to thankyou for your help. I don't do this as carreer I just volunteered to do site for the varsity high school basketball team. Happy New Year

I think your mis understanding me. You put code on top of php page and then you put code in the body of the page where visitors see the result that's what I meant by saying the body. Thanks

This what I have on top of page.

<?php require_once('../Connections/Connection.php'); ?>
<?php
mysql_select_db($database_Connection, $Connection);
$query_statz = "SELECT * FROM stats ORDER BY ID ASC";
$statz = mysql_query($query_statz, $Connection) or die(mysql_error());
$row_statz = mysql_fetch_assoc($statz);
$totalRows_statz = mysql_num_rows($statz);

mysql_select_db($database_Connection, $Connection);
$query_playerz = "SELECT * FROM players";
$playerz = mysql_query($query_playerz, $Connection) or die(mysql_error());
$row_playerz = mysql_fetch_assoc($playerz);
$totalRows_playerz = mysql_num_rows($playerz);

mysql_select_db($database_Connection, $Connection);
$query_gamez = "SELECT * FROM games";
$gamez = mysql_query($query_gamez, $Connection) or die(mysql_error());
$row_gamez = mysql_fetch_assoc($gamez);
$totalRows_gamez = mysql_num_rows($gamez);

?>

I created three tables in database stats,games,players all the stats are in the stats table.
I understand the head / body part. PHP does not have to explicitly be placed in the head. I have loads of php code within the <body>  </body> tags as does a lot of others here.

[code]<?php
mysql_select_db($database_Connection, $Connection);
$query = "SELECT gid FROM stats GROUP BY gid"; //try this at first without the limit
$result = mysql_query($query,$link);
$number = mysql_num_rows($result);
echo 'Number of games played: '.$number;
$query = "SELECT pid,COUNT(gid) AS CTgid FROM stats GROUP BY pid LIMIT $start, $length"
$result = mysql_query($query,$link);
while($row = mysql_fetch_array($result)) {
echo 'Player ID: '.$row['pid'].'
';
echo 'Number of games: '.$row['CTgid'].'

';
?>[/code]

This line can go in the body right where you want results to display. If it is placed in the head tags, it will be printing the player id and number of games above the actual page. 

Looks to me like in the 3 queries in your last post, you are missing a while loop to actually loop through the results and extract them.

You will need to do something like

[code]while($row_statz=mysql_fetch_assoc($statz)){
echo $row_statz['fieldname'];
echo $row_statz['next_field'];
}[/code]

to actually extract the results and display them.
I tried this and it returns blank.
<?php
mysql_select_db($database_Connection, $Connection);
$query = "SELECT gid FROM stats GROUP BY gid LIMIT $start, $length";
$result = mysql_query($query);
?>

<?php echo $result['pts'];?>

What is wrong with this code? thankyou much
You need a line like this.
[code]
while($row=mysql_fetch_assoc($result)){
echo $row['pts'];
}[/code]

this loops through the results as long as there are results to display.

Your code is not actually pulling the results, the $result var is returning a line like "resource id 2"

Just for future reference, there are a 3 things you have to do to get results.

1. Create your query e.g. [code]$query="SELECT gid FROM stats GROUP BY gid LIMIT $start $length";[/code]
2. Run the query e.g. [code]$result=mysql_query($query);[/code]
3. Create a while loop to loop through the results. e.g. [code]while($row=mysql_fetch_assoc($result)){echo $row['nameoffield']; };[/code]

You can also use mysql_fetch_array(), mysql_fetch_object(), and a few others, check out the php manual for these. [url=http://us2.php.net/manual/en/ref.mysql.php]http://us2.php.net/manual/en/ref.mysql.php[/url]  look toward the bottom in the table of contents and look at the mysql_fetch_XXXX  functions. These are what actually make the results usable to you.

Hope this helps

Nate

I GET THIS ERROR:
Parse error: syntax error, unexpected $end in /home/PATH/testing5.php on line 52

THE PAGE LOOKS LIKE THIS: THE VERY LAST LINE IS LINE 52:

<?php require_once('../Connections/Connection.php'); ?>
<?php
mysql_select_db($database_Connection, $Connection);
$query = "SELECT gid FROM stats GROUP BY gid";
$result = mysql_query($query);
while($row = mysql_fetch_array($result)) {
echo 'Points: '.$row['Pts'].'
';
echo 'Field Goals: '.$row['2FG'].'
';
?>

<?php
mysql_select_db($database_Connection, $Connection);
$query_statz = "SELECT * FROM stats";
$statz = mysql_query($query_statz, $Connection) or die(mysql_error());
$row_statz = mysql_fetch_assoc($statz);
$totalRows_statz = mysql_num_rows($statz);
$total_statz = "SELECT DISTINCT gid FROM stats";

mysql_select_db($database_Connection, $Connection);
$query_gamez = "SELECT * FROM games";
$gamez = mysql_query($query_gamez, $Connection) or die(mysql_error());
$row_gamez = mysql_fetch_assoc($gamez);
$totalRows_gamez = mysql_num_rows($gamez);

mysql_select_db($database_Connection, $Connection);
$query_playerz = "SELECT * FROM players";
$playerz = mysql_query($query_playerz, $Connection) or die(mysql_error());
$row_playerz = mysql_fetch_assoc($playerz);
$totalRows_playerz = mysql_num_rows($playerz);
?>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>

<body>

<?php echo $result['pts'];?>

</body>
</html>
<?php
mysql_free_result($statz);

mysql_free_result($gamez);

mysql_free_result($playerz);
?>
You did not end the while loop properly. Anytime you start an if(){} or while(){} or any other function that requires closing, if you don't close it the error will say that an unexpected end occured in the last line, because the last line is the final chance to close it.

Try this.... I put the code in the body of the page since that is where you want the Points and Field Goals to echo. The way you had it those vars would echo above the entire page even before your <html> tag.

I also closed the while loop and changed how the 2 echo statements ended. The .' '; was not needed. However, I just thought about it... That was probably to give you a space there right?? if so, simply add that back into those lines.


[code]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>

<body>
<?php require_once('../Connections/Connection.php'); ?>
<?php
mysql_select_db($database_Connection, $Connection);
$query = "SELECT gid FROM stats GROUP BY gid";
$result = mysql_query($query);
while($row = mysql_fetch_assoc($result)) {
echo 'Points: '.$row['Pts'];
echo 'Field Goals: '.$row['2FG'];
}; //end while loop
?>

<?php
mysql_select_db($database_Connection, $Connection);
$query_statz = "SELECT * FROM stats";
$statz = mysql_query($query_statz, $Connection) or die(mysql_error());
$row_statz = mysql_fetch_assoc($statz);
$totalRows_statz = mysql_num_rows($statz);
$total_statz = "SELECT DISTINCT gid FROM stats";

mysql_select_db($database_Connection, $Connection);
$query_gamez = "SELECT * FROM games";
$gamez = mysql_query($query_gamez, $Connection) or die(mysql_error());
$row_gamez = mysql_fetch_assoc($gamez);
$totalRows_gamez = mysql_num_rows($gamez);

mysql_select_db($database_Connection, $Connection);
$query_playerz = "SELECT * FROM players";
$playerz = mysql_query($query_playerz, $Connection) or die(mysql_error());
$row_playerz = mysql_fetch_assoc($playerz);
$totalRows_playerz = mysql_num_rows($playerz);
?>

<?php echo $result['pts'];?>

</body>
</html>
<?php
mysql_free_result($statz);

mysql_free_result($gamez);

mysql_free_result($playerz);
?>[/code]
Ok GREAT I'm getting excited. Thankyou so much for your help.
I got this to work:
<?php
mysql_select_db($database_Connection, $Connection);
$query = "SELECT Pts, 2FG, 3FG  FROM stats GROUP BY gid";
$result = mysql_query($query);
while($row = mysql_fetch_assoc($result)) {
echo 'Points: '.$row['Pts'].'<br/>';
echo 'Field Goals: '.$row['2FG'].'<br/>';
}; //end while loop
?>

But Is there a way to input results within a <table><tr><td> without hard coding html within the php code??

The table I use is this:

<table width="100%" border="1" cellspacing="0" cellpadding="0">
      <tr>
        <td width="7%"><u><strong>Date</strong></u></td>
        <td width="7%"><div align="center"><strong><u>Opp</u></strong></div></td>
        <td width="7%"><div align="center"><strong><u>Loc</u></strong></div></td>
        <td width="8%"><div align="center"><strong><u>Ourscore</u></strong></div></td>
        <td width="8%"><div align="center"><strong><u>Oppscore</u></strong></div></td>
        <td width="8%"><div align="center"><strong><u>Results</u></strong></div></td>
        <td width="6%"><div align="center"><u><strong>PF</strong></u></div></td>
        <td width="6%"><div align="center"><u><strong>3pts</strong></u></div></td>
        <td width="7%"><div align="center"><u><strong>Free Throws</strong></u></div></td>
        <td width="7%"><div align="center"><u><strong>Off Reb</strong></u></div></td>
        <td width="9%"><div align="center"><u><strong>Def Reb</strong></u></div></td>
        <td width="10%"><div align="center"><u><strong>TO</strong></u></div></td>
        <td width="8%"><div align="center"><u><strong>Stl</strong></u></div></td>
        <td width="9%"><div align="center"><u><strong>Ast</strong></u></div></td>
        <td width="9%"><div align="center"><u><strong>Blks</strong></u></div></td>
      </tr>
            <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td><strong>Total:</strong></td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
  </tr>
  <tr>
        <td><strong>AVG:</strong></td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
</table>

Ok the code above displays the results from all unique games. I would eventually like to show the sum or total of all stats plus the avgerage of all stats below the unique game results. The table above displays the layout. How can I accomplish this?


Another way I tried to show the unique game result is below but get error on line 76 plus it is not repeating the <td> with the unique game results.

<?php
mysql_select_db($database_Connection, $Connection);
$query = "SELECT gid, Pts, 2FG, 3FG  FROM stats GROUP BY gid";
$result = mysql_query($query);
$myrow = mysql_fetch_assoc($result);
//end while loop
?>

<table width="100%" border="1" cellspacing="0" cellpadding="0">
      <tr>
        <td width="7%"><u><strong>Date</strong></u></td>
        <td width="7%"><div align="center"><strong><u>Opp</u></strong></div></td>
        <td width="7%"><div align="center"><strong><u>Loc</u></strong></div></td>
        <td width="8%"><div align="center"><strong><u>Ourscore</u></strong></div></td>
        <td width="8%"><div align="center"><strong><u>Oppscore</u></strong></div></td>
        <td width="8%"><div align="center"><strong><u>Results</u></strong></div></td>
        <td width="6%"><div align="center"><u><strong>PF</strong></u></div></td>
        <td width="6%"><div align="center"><u><strong>3pts</strong></u></div></td>
        <td width="7%"><div align="center"><u><strong>Free Throws</strong></u></div></td>
        <td width="7%"><div align="center"><u><strong>Off Reb</strong></u></div></td>
        <td width="9%"><div align="center"><u><strong>Def Reb</strong></u></div></td>
        <td width="10%"><div align="center"><u><strong>TO</strong></u></div></td>
        <td width="8%"><div align="center"><u><strong>Stl</strong></u></div></td>
        <td width="9%"><div align="center"><u><strong>Ast</strong></u></div></td>
        <td width="9%"><div align="center"><u><strong>Blks</strong></u></div></td>
      </tr>     
      <?php do { ?>
      <tr>
        <td><?php echo $myrow['Pts']; ?></td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
  <?php } while ($myrow = mysql_fetch_assoc($myrow)); ?> //this is line 76
     
<tr>
        <td><strong>Total:</strong></td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
  </tr>
  <tr>
        <td><strong>AVG:</strong></td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
</table>

But I get this error
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/path/testing6.php on line 76

line 76 is just above.
Just to show how I got sum and average last season. [b][font=Verdana]BUT[/font] I made a table in database for each player[/b].
I was told to make only one table for all stat totals this season so not so hard to input data.

<?php
mysql_select_db($database_schedule, $schedule);
$sql = "SELECT SUM(Ourscore) AS Sum_Ourscore FROM `schedule` ";
$sql1 = "SELECT SUM(Oppscore) AS Sum_Oppscore FROM `schedule` ";
$sql2 = "SELECT SUM(Points) AS Sum_Points FROM `schedule` ";
$sql3 = "SELECT SUM(3pts) AS Sum_3pts FROM `schedule` ";
$sql4 = "SELECT SUM(freethrows) AS Sum_freethrows FROM `schedule` ";
$sql5 = "SELECT SUM(OffRebounds) AS Sum_OffRebounds FROM `schedule` ";
$sql6 = "SELECT SUM(DefRebounds) AS Sum_DefRebounds FROM `schedule` ";
$sql7 = "SELECT SUM(Turnovers) AS Sum_Turnovers FROM `schedule` ";
$sql8 = "SELECT SUM(Steals) AS Sum_Steals FROM `schedule` ";
$sql9 = "SELECT SUM(Assists) AS Sum_Assists FROM `schedule` ";
$sql10 = "SELECT SUM(Blocks) AS Sum_Blocks FROM `schedule` ";
$result = mysql_query($sql) or die(mysql_error());
$result1 = mysql_query($sql1) or die(mysql_error());
$result2 = mysql_query($sql2) or die(mysql_error());
$result3 = mysql_query($sql3) or die(mysql_error());
$result4 = mysql_query($sql4) or die(mysql_error());
$result5 = mysql_query($sql5) or die(mysql_error());
$result6 = mysql_query($sql6) or die(mysql_error());
$result7 = mysql_query($sql7) or die(mysql_error());
$result8 = mysql_query($sql8) or die(mysql_error());
$result9 = mysql_query($sql9) or die(mysql_error());
$result10 = mysql_query($sql10) or die(mysql_error());
$a = mysql_fetch_array($result);
$b = mysql_fetch_array($result1);
$c = mysql_fetch_array($result2);
$d = mysql_fetch_array($result3);
$e = mysql_fetch_array($result4);
$f = mysql_fetch_array($result5);
$g = mysql_fetch_array($result6);
$h = mysql_fetch_array($result7);
$i = mysql_fetch_array($result8);
$j = mysql_fetch_array($result9);
$k = mysql_fetch_array($result10);
?>


<td><?php echo $a['Sum_Ourscore']; ?></td>  // this is what I put within each <td> for the sum.



This code below is what I put within each <td> for the average.

<?php
$query2 = "SELECT avg(Ourscore) from schedule";

$result18 = mysql_query($query2);
$row2 = mysql_fetch_array($result18);

echo "".(round($row2[0]))." ";
?>

That is why I would like to display results using the second method. I hope this makes sense. Again I want to thankyou for your help.

Basically the second method I would not have to hard code html code within the php code. Wouldn't it be better to put some php code within html code to display results??

I will paste what I did last season for everything [b]but with table made for each player[/b]. Now I only have three tables in database.

<?php require_once('../Connections/schedule.php'); ?>
<?php
$colname_blakeb = "7";
if (isset($_GET['ID'])) {
  $colname_blakeb = (get_magic_quotes_gpc()) ? $_GET['ID'] : addslashes($_GET['ID']);
}
mysql_select_db($database_schedule, $schedule);
$query_blakeb = sprintf("SELECT * FROM players WHERE ID = %s", $colname_blakeb);
$blakeb = mysql_query($query_blakeb, $schedule) or die(mysql_error());
$row_blakeb = mysql_fetch_assoc($blakeb);
$totalRows_blakeb = mysql_num_rows($blakeb);

mysql_select_db($database_schedule, $schedule);
$sql = "SELECT SUM(Ourscore) AS Sum_Ourscore FROM `schedule` ";
$sql1 = "SELECT SUM(Oppscore) AS Sum_Oppscore FROM `schedule` ";
$sql2 = "SELECT SUM(Points) AS Sum_Points FROM `schedule` ";
$sql3 = "SELECT SUM(3pts) AS Sum_3pts FROM `schedule` ";
$sql4 = "SELECT SUM(freethrows) AS Sum_freethrows FROM `schedule` ";
$sql5 = "SELECT SUM(OffRebounds) AS Sum_OffRebounds FROM `schedule` ";
$sql6 = "SELECT SUM(DefRebounds) AS Sum_DefRebounds FROM `schedule` ";
$sql7 = "SELECT SUM(Turnovers) AS Sum_Turnovers FROM `schedule` ";
$sql8 = "SELECT SUM(Steals) AS Sum_Steals FROM `schedule` ";
$sql9 = "SELECT SUM(Assists) AS Sum_Assists FROM `schedule` ";
$sql10 = "SELECT SUM(Blocks) AS Sum_Blocks FROM `schedule` ";
$result = mysql_query($sql) or die(mysql_error());
$result1 = mysql_query($sql1) or die(mysql_error());
$result2 = mysql_query($sql2) or die(mysql_error());
$result3 = mysql_query($sql3) or die(mysql_error());
$result4 = mysql_query($sql4) or die(mysql_error());
$result5 = mysql_query($sql5) or die(mysql_error());
$result6 = mysql_query($sql6) or die(mysql_error());
$result7 = mysql_query($sql7) or die(mysql_error());
$result8 = mysql_query($sql8) or die(mysql_error());
$result9 = mysql_query($sql9) or die(mysql_error());
$result10 = mysql_query($sql10) or die(mysql_error());
$a = mysql_fetch_array($result);
$b = mysql_fetch_array($result1);
$c = mysql_fetch_array($result2);
$d = mysql_fetch_array($result3);
$e = mysql_fetch_array($result4);
$f = mysql_fetch_array($result5);
$g = mysql_fetch_array($result6);
$h = mysql_fetch_array($result7);
$i = mysql_fetch_array($result8);
$j = mysql_fetch_array($result9);
$k = mysql_fetch_array($result10);

$colname_brianl = "5";
if (isset($_GET['ID'])) {
  $colname_brianl = (get_magic_quotes_gpc()) ? $_GET['ID'] : addslashes($_GET['ID']);
}
mysql_select_db($database_schedule, $schedule);
$query_brianl = sprintf("SELECT * FROM players WHERE ID = %s", $colname_brianl);
$brianl = mysql_query($query_brianl, $schedule) or die(mysql_error());
$row_brianl = mysql_fetch_assoc($brianl);
$totalRows_brianl = mysql_num_rows($brianl);

$colname_drewv = "8";
if (isset($_GET['ID'])) {
  $colname_drewv = (get_magic_quotes_gpc()) ? $_GET['ID'] : addslashes($_GET['ID']);
}
mysql_select_db($database_schedule, $schedule);
$query_drewv = sprintf("SELECT * FROM players WHERE ID = %s", $colname_drewv);
$drewv = mysql_query($query_drewv, $schedule) or die(mysql_error());
$row_drewv = mysql_fetch_assoc($drewv);
$totalRows_drewv = mysql_num_rows($drewv);

$colname_jamesc = "10";
if (isset($_GET['ID'])) {
  $colname_jamesc = (get_magic_quotes_gpc()) ? $_GET['ID'] : addslashes($_GET['ID']);
}
mysql_select_db($database_schedule, $schedule);
$query_jamesc = sprintf("SELECT * FROM players WHERE ID = %s", $colname_jamesc);
$jamesc = mysql_query($query_jamesc, $schedule) or die(mysql_error());
$row_jamesc = mysql_fetch_assoc($jamesc);
$totalRows_jamesc = mysql_num_rows($jamesc);

$colname_johnf = "9";
if (isset($_GET['ID'])) {
  $colname_johnf = (get_magic_quotes_gpc()) ? $_GET['ID'] : addslashes($_GET['ID']);
}
mysql_select_db($database_schedule, $schedule);
$query_johnf = sprintf("SELECT * FROM players WHERE ID = %s", $colname_johnf);
$johnf = mysql_query($query_johnf, $schedule) or die(mysql_error());
$row_johnf = mysql_fetch_assoc($johnf);
$totalRows_johnf = mysql_num_rows($johnf);

$colname_rileyj = "1";
if (isset($_GET['ID'])) {
  $colname_rileyj = (get_magic_quotes_gpc()) ? $_GET['ID'] : addslashes($_GET['ID']);
}
mysql_select_db($database_schedule, $schedule);
$query_rileyj = sprintf("SELECT * FROM players WHERE ID = %s", $colname_rileyj);
$rileyj = mysql_query($query_rileyj, $schedule) or die(mysql_error());
$row_rileyj = mysql_fetch_assoc($rileyj);
$totalRows_rileyj = mysql_num_rows($rileyj);

$colname_seanm = "3";
if (isset($_GET['ID'])) {
  $colname_seanm = (get_magic_quotes_gpc()) ? $_GET['ID'] : addslashes($_GET['ID']);
}
mysql_select_db($database_schedule, $schedule);
$query_seanm = sprintf("SELECT * FROM players WHERE ID = %s", $colname_seanm);
$seanm = mysql_query($query_seanm, $schedule) or die(mysql_error());
$row_seanm = mysql_fetch_assoc($seanm);
$totalRows_seanm = mysql_num_rows($seanm);

$colname_seanw = "11";
if (isset($_GET['ID'])) {
  $colname_seanw = (get_magic_quotes_gpc()) ? $_GET['ID'] : addslashes($_GET['ID']);
}
mysql_select_db($database_schedule, $schedule);
$query_seanw = sprintf("SELECT * FROM players WHERE ID = %s", $colname_seanw);
$seanw = mysql_query($query_seanw, $schedule) or die(mysql_error());
$row_seanw = mysql_fetch_assoc($seanw);
$totalRows_seanw = mysql_num_rows($seanw);

$colname_zackt = "6";
if (isset($_GET['ID'])) {
  $colname_zackt = (get_magic_quotes_gpc()) ? $_GET['ID'] : addslashes($_GET['ID']);
}
mysql_select_db($database_schedule, $schedule);
$query_zackt = sprintf("SELECT * FROM players WHERE ID = %s", $colname_zackt);
$zackt = mysql_query($query_zackt, $schedule) or die(mysql_error());
$row_zackt = mysql_fetch_assoc($zackt);
$totalRows_zackt = mysql_num_rows($zackt);

$colname_kerte = "4";
if (isset($_GET['ID'])) {
  $colname_kerte = (get_magic_quotes_gpc()) ? $_GET['ID'] : addslashes($_GET['ID']);
}
mysql_select_db($database_schedule, $schedule);
$query_kerte = sprintf("SELECT * FROM players WHERE ID = %s", $colname_kerte);
$kerte = mysql_query($query_kerte, $schedule) or die(mysql_error());
$row_kerte = mysql_fetch_assoc($kerte);
$totalRows_kerte = mysql_num_rows($kerte);

$colname_andrews = "2";
if (isset($_GET['ID'])) {
  $colname_andrews = (get_magic_quotes_gpc()) ? $_GET['ID'] : addslashes($_GET['ID']);
}
mysql_select_db($database_schedule, $schedule);
$query_andrews = sprintf("SELECT * FROM players WHERE ID = %s", $colname_andrews);
$andrews = mysql_query($query_andrews, $schedule) or die(mysql_error());
$row_andrews = mysql_fetch_assoc($andrews);
$totalRows_andrews = mysql_num_rows($andrews);

mysql_select_db($database_schedule, $schedule);
$query_stats = "SELECT * FROM schedule ORDER BY `Date` ASC";
$stats = mysql_query($query_stats, $schedule) or die(mysql_error());
$row_stats = mysql_fetch_assoc($stats);
$totalRows_stats = mysql_num_rows($stats);

mysql_select_db($database_schedule, $schedule);
$query_playoffs = "SELECT * FROM person ORDER BY `Date` ASC";
$playoffs = mysql_query($query_playoffs, $schedule) or die(mysql_error());
$row_playoffs = mysql_fetch_assoc($playoffs);
$totalRows_playoffs = mysql_num_rows($playoffs);

mysql_select_db($database_schedule, $schedule);
$query_winloss = "SELECT * FROM stats";
$winloss = mysql_query($query_winloss, $schedule) or die(mysql_error());
$row_winloss = mysql_fetch_assoc($winloss);
$totalRows_winloss = mysql_num_rows($winloss);
?>
<html>
<head> 
  <title>Villa Park Basketball - villa park high school basketball </title>


<table width="100%" border="1" cellspacing="0" cellpadding="0">
      <tr>
        <td width="7%"><u><strong>Date</strong></u></td>
        <td width="20%"><div align="center"><strong><u>Opp</u></strong></div></td>
        <td width="11%"><div align="center"><strong><u>Loc</u></strong></div></td>
        <td width="8%"><div align="center"><strong><u>Ourscore</u></strong></div></td>
        <td width="8%"><div align="center"><strong><u>Oppscore</u></strong></div></td>
        <td width="8%"><div align="center"><strong><u>Results</u></strong></div></td>
        <td width="6%"><div align="center"><u><strong>Pts</strong></u></div></td>
        <td width="6%"><div align="center"><u><strong>3pts</strong></u></div></td>
        <td width="11%"><div align="center"><u><strong>Free Throws</strong></u></div></td>
        <td width="7%"><div align="center"><u><strong>Off Reb</strong></u></div></td>
        <td width="9%"><div align="center"><u><strong>Def Reb</strong></u></div></td>
        <td width="10%"><div align="center"><u><strong>TO</strong></u></div></td>
        <td width="8%"><div align="center"><u><strong>Stl</strong></u></div></td>
        <td width="9%"><div align="center"><u><strong>Ast</strong></u></div></td>
        <td width="9%"><div align="center"><u><strong>Blks</strong></u></div></td>
      </tr>
      <?php do { ?>
      <tr>
        <td><?php echo $row_stats['Date2']; ?></td>
        <td><?php echo $row_stats['Opponent']; ?></td>
        <td><?php echo $row_stats['Location']; ?></td>
        <td><div align="center"><?php echo $row_stats['Ourscore']; ?></div></td>
        <td><div align="center"><?php echo $row_stats['Oppscore']; ?></div></td>
        <td><div align="center"><?php echo $row_stats['Results']; ?></div></td>
        <td><div align="center"><?php echo $row_stats['Points']; ?></div></td>
        <td><div align="center"><?php echo $row_stats['3pts']; ?></div></td>
        <td><div align="center"><?php echo $row_stats['freethrows']; ?></div></td>
        <td><div align="center"><?php echo $row_stats['OffRebounds']; ?></div></td>
        <td><div align="center"><?php echo $row_stats['DefRebounds']; ?></div></td>
        <td><div align="center"><?php echo $row_stats['Turnovers']; ?></div></td>
        <td><div align="center"><?php echo $row_stats['Steals']; ?></div></td>
        <td><div align="center"><?php echo $row_stats['Assists']; ?></div></td>
        <td><div align="center"><?php echo $row_stats['Blocks']; ?></div></td>
      </tr>
      <?php } while ($row_stats = mysql_fetch_assoc($stats)); ?>
      <tr>
        <td><strong>Total:</strong></td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td><div align="center"><?php echo $a['Sum_Ourscore']; ?></div></td>
        <td><div align="center"><?php echo $b['Sum_Oppscore']; ?></div></td>
        <td>&nbsp;</td>
        <td><div align="center"><?php echo $c['Sum_Points']; ?></div></td>
        <td><div align="center"><?php echo $d['Sum_3pts']; ?></div></td>
        <td><div align="center"><?php echo $e['Sum_freethrows']; ?></div></td>
        <td><div align="center"><?php echo $f['Sum_OffRebounds']; ?></div></td>
        <td><div align="center"><?php echo $g['Sum_DefRebounds']; ?></div></td>
        <td><div align="center"><?php echo $h['Sum_Turnovers']; ?></div></td>
        <td><div align="center"><?php echo $i['Sum_Steals']; ?></div></td>
        <td><div align="center"><?php echo $j['Sum_Assists']; ?></div></td>
        <td><div align="center"><?php echo $k['Sum_Blocks']; ?></div></td>
      </tr>
  <tr>
        <td><strong>AVG:</strong></td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td><div align="center">
          <?php
$query2 = "SELECT avg(Ourscore) from schedule";

$result18 = mysql_query($query2);
$row2 = mysql_fetch_array($result18);

echo "".(round($row2[0]))." ";
?>
        </div></td>
        <td><div align="center">
          <?php
$query2 = "SELECT avg(Oppscore) from schedule";

$result18 = mysql_query($query2);
$row2 = mysql_fetch_array($result18);

echo "".(round($row2[0]))." ";
?>
        </div></td>
        <td>&nbsp;</td>
        <td><div align="center">
          <?php
$query2 = "SELECT avg(Points) from schedule";

$result18 = mysql_query($query2);
$row2 = mysql_fetch_array($result18);

echo "".(round($row2[0]))." ";
?>
        </div></td>
        <td><div align="center">
          <?php
$query2 = "SELECT avg(3pts) from schedule";

$result18 = mysql_query($query2);
$row2 = mysql_fetch_array($result18);

echo "".(round($row2[0]))." ";
?>
        </div></td>
        <td><div align="center">
          <?php
$query2 = "SELECT avg(freethrows) from schedule";

$result18 = mysql_query($query2);
$row2 = mysql_fetch_array($result18);

echo "".(round($row2[0]))." ";
?>
        </div></td>
        <td><div align="center">
          <?php
$query2 = "SELECT avg(OffRebounds) from schedule";

$result18 = mysql_query($query2);
$row2 = mysql_fetch_array($result18);

echo "".(round($row2[0]))." ";
?>
        </div></td>
        <td><div align="center">
          <?php
$query2 = "SELECT avg(DefRebounds) from schedule";

$result18 = mysql_query($query2);
$row2 = mysql_fetch_array($result18);

echo "".(round($row2[0]))." ";
?>
        </div></td>
        <td><div align="center">
          <?php
$query2 = "SELECT avg(Turnovers) from schedule";

$result18 = mysql_query($query2);
$row2 = mysql_fetch_array($result18);

echo "".(round($row2[0]))." ";
?>
        </div></td>
        <td><div align="center">
          <?php
$query2 = "SELECT avg(Steals) from schedule";

$result18 = mysql_query($query2);
$row2 = mysql_fetch_array($result18);

echo "".(round($row2[0]))." ";
?>
        </div></td>
        <td><div align="center">
          <?php
$query2 = "SELECT avg(Assists) from schedule";

$result18 = mysql_query($query2);
$row2 = mysql_fetch_array($result18);

echo "".(round($row2[0]))." ";
?>
        </div></td>
        <td><div align="center">
          <?php
$query2 = "SELECT avg(Blocks) from schedule";

$result18 = mysql_query($query2);
$row2 = mysql_fetch_array($result18);

echo "".(round($row2[0]))." ";
?>
        </div></td>
      </tr>
    </table>
   

</html>
<?php
mysql_free_result($blakeb);

mysql_free_result($brianl);

mysql_free_result($drewv);

mysql_free_result($jamesc);

mysql_free_result($johnf);

mysql_free_result($rileyj);

mysql_free_result($seanm);

mysql_free_result($seanw);

mysql_free_result($zackt);

mysql_free_result($kerte);

mysql_free_result($andrews);

mysql_free_result($stats);

mysql_free_result($playoffs);

mysql_free_result($winloss);
?>
   
[b]Thankyou So Much[/b]

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.