connect_error)
{
exit("Connection failed: " . $conn->connect_error);
}
?>
Welcome!
query($query) === TRUE)
{
?> Athlete Added!
" .$conn->error;
echo "Please contact your Dr. Diederich if this error persists. ";
echo "Try Again Here
";
}
}
else if(isset($_GET['dropped']))
{
//Dropping the athlete
//get the number of inactive athletes
$query = "SELECT * FROM Inactive_Data";
if($conn->query($query))
{
$numRows = mysqli_num_rows($conn->query($query));
}
//getting athlete id
//variables
$firstName = $_POST['first'];
$lastName = $_POST['last'];
$query = "SELECT A_ID FROM Athlete_Info WHERE A_F_Name = '{$firstName}' AND A_L_Name = '{$lastName}'";
$result = $conn->query($query);
$athlete = $result->fetch_assoc();
$A_ID = $athlete['A_ID'];
$C_ID = $_SESSION['id'];
//moving athlete
$query = "SELECT * FROM Test_Data WHERE ID = '{$A_ID}'"; //Change to Athlete_Data, potentially change the variable to A_ID as well
$results = $conn->query($query);
while($row = $results->fetch_assoc())
{
$date = str_replace('-', '', $row['Date']);
$moveQuery = "INSERT INTO Inactive_Data (A_ID, C_ID, Date, physical, academic, perform, relation, sleep, meeting) VALUES ('{$A_ID}','{$C_ID}','{$date}','{$row['physical']}','{$row['academic']}','{$row['perform']}','{$row['relation']}','{$row['sleep']}','{$row['meeting']}')";
$conn->query($moveQuery);
}
//checking if the athlete has been moved
$query = "SELECT * FROM Inactive_Data";
if($conn->query($query))
{
$NEWnumRows = mysqli_num_rows($conn->query($query));
}
if($NEWnumRows > $numRows)
{
//the athlete has been moved and will now be deleted from the data table.
$query = "DELETE FROM Test_Data WHERE ID = '{$A_ID}'"; //Change to Athlete_Data, potentially change the variable to A_ID as well
$conn->query($query);
?>
Athlete Removed
TRY AGAIN
query($query))
{
$numRows = mysqli_num_rows($conn->query($query));
}
//getting athlete id
//variables
$firstName = $_POST['first'];
$lastName = $_POST['last'];
$query = "SELECT A_ID FROM Athlete_Info WHERE A_F_Name = '{$firstName}' AND A_L_Name = '{$lastName}'";
$result = $conn->query($query);
$athlete = $result->fetch_assoc();
$A_ID = $athlete['A_ID'];
//moving athlete
$query = "SELECT A_ID, Date, physical, academic, perform, relation, sleep, meeting FROM Inactive_Data WHERE A_ID = '{$A_ID}'";
$results = $conn->query($query);
while($row = $results->fetch_assoc())
{
$date = str_replace('-', '', $row['Date']);
$moveQuery = "INSERT INTO Test_Data (ID, Date, physical, academic, perform, relation, sleep, meeting) VALUES ('{$A_ID}','{$date}','{$row['physical']}','{$row['academic']}','{$row['perform']}','{$row['relation']}','{$row['sleep']}','{$row['meeting']}')"; //Change to Athlete_Data, potentially change the variable to A_ID as well
$conn->query($moveQuery);
}
//checking if the athlete has been moved
$query = "SELECT * FROM Test_Data"; //Change to Athlete_Data
if($conn->query($query))
{
$NEWnumRows = mysqli_num_rows($conn->query($query));
}
if($NEWnumRows > $numRows)
{
//the athlete has been moved and will now be deleted from the data table.
$query = "DELETE FROM Inactive_Data WHERE A_ID = '{$A_ID}'";
$conn->query($query);
?>
Athlete Restored!
TRY AGAIN
Student Athlete Data
= $daysConcerning)
{
//The number of days of high stress are greater or equal to the amount of days that are concerning
if($curStress <= $Constraint)
{
//the current day is high stress as well, so mark it down as red, increase variable
echo ''.$curStress;
$athleteVariable++;
}
else
{
//current day wasn't high stress so reset the variable
echo ' | '.$curStress;
$athleteVariable = 0;
}
}
else
{
//Less than days that are concerning
if($curStress <= $Constraint)
{
//high stress day, mark as yellow, increase variable
echo ' | '.$curStress;
$athleteVariable++;
}
else
{
//low stress day, reset variable
echo ' | '.$curStress;
$athleteVariable = 0;
}
}
}
else
{
if($athleteVariable >= $daysConcerning)
{
//The number of days of high stress are greater or equal to the amount of days that are concerning
if($curStress >= $Constraint)
{
//the current day is high stress as well, so mark it down as red, increase variable
echo ' | '.$curStress;
$athleteVariable++;
}
else
{
//current day wasn't high stress so reset the variable
echo ' | '.$curStress;
$athleteVariable = 0;
}
}
else
{
//Less than days that are concerning
if($curStress >= $Constraint)
{
//high stress day, mark as yellow, increase variable
echo ' | '.$curStress;
$athleteVariable++;
}
else
{
//low stress day, reset variable
echo ' | '.$curStress;
$athleteVariable = 0;
}
}
}
return $athleteVariable;
}
function changeDate($Date)
//This function serves to make the date more readable
{
$day = $Date % 100; //gets the day from the Date
//$month = strval($month);
$Date = $Date / 100; //makes the day into a decimal in the Date
$month = $Date % 100; //gets the month from the Date
//$day = strval($day);
$Date = $Date / 100; //makes the month into a decimal in the Date
$year = $Date % 10000; //gets the year from the Date
//$year = strval($year);
//$Date = $month + '/' + $day + '/' + $year;
//return $Date;
echo $month.'/'.$day.'/'.$year; //puts it together in a readable way
}
//checking who
if($who == 'team')
{
//the coach wants to see the whole team
if($what == 'all')
{
//the coach wants to see all the data.
//Query to see all the players under the coach within a certain date
$query = "SELECT * FROM Team JOIN Test_Data WHERE Team.A_ID = Test_Data.ID AND Test_Data.Date >= '{$startdate}' AND Test_Data.Date <= '{$enddate}' AND Team.C_ID = '{$C_ID}' ORDER BY Test_Data.ID ASC, Test_Data.Date ASC"; //Change to Athlete_Data, potentially change the variable to A_ID as well
//get the results
$results = $conn->query($query);
while($row = $results->fetch_assoc())
{
?>
ID | |
Date | Physical Score | Academic Score | Performance Score | Relationship Score | Hours of Sleep | Meeting |
| |
ID | |
Date | Physical Score | Academic Score | Performance Score | Relationship Score | Hours of Sleep | Meeting |
| |
ID | |
Date | Physical Score | Academic Score | Performance Score | Relationship Score | Hours of Sleep | Meeting |
| |
You can only get the averages of a single player at a time';
echo "Try Again Here ";
}
}
else //Coach wants to see an individual player
{
if(!isset($_SESSION['multiQuery']))
{
$_SESSION['multiQuery'] = array();
}
//the coach wants to see an individual player
$athlete = $_POST['indiv']; //get the athlete desired
$athlete = strtolower($athlete); //make sure its lowercase
if($what == 'averages')
{
//The coach wants to see a specific player, but wants to see their averages
//query to get the averages
$query = "SELECT Test_Data.ID, AVG(Test_Data.physical), AVG(Test_Data.academic), AVG(Test_Data.perform), AVG(Test_Data.relation), AVG(Test_Data.sleep), Test_Data.meeting FROM Team JOIN Test_Data WHERE Team.A_ID = Test_Data.ID AND Test_Data.Date >= '{$startdate}' AND Test_Data.Date <= '{$enddate}' AND Team.C_ID = '{$C_ID}'AND Test_Data.ID = '{$athlete}' ORDER BY Test_Data.ID ASC, Test_Data.Date ASC"; //Change to Athlete_Data, potentially change the variable to A_ID as well
$results = $conn->query($query);
while($row = $results->fetch_assoc())
{
?>
ID | |
Physical Score | Academic Score | Performance Score | Relationship Score | Hours of Sleep |
| | | | |
$value)
{
//print out all the players requested
//echo $value." ";
//echo 'The value of $_SESSION['."'".$key."'".'] is '."'".$value."'".' ';
$query = $value;
$results = $conn->query($query);
while($row = $results->fetch_assoc())
{
?>
ID | |
Physical Score | Academic Score | Performance Score | Relationship Score | Hours of Sleep |
| | | | |
= '{$startdate}' AND Test_Data.Date <= '{$enddate}' AND Team.C_ID = '{$C_ID}' AND Test_Data.ID = '{$athlete}' ORDER BY Test_Data.ID ASC, Test_Data.Date ASC"; //Change to Athlete_Data, potentially change the variable to A_ID as well
$results = $conn->query($query);
while($row = $results->fetch_assoc())
{
?>
ID | |
Date | Physical Score | Academic Score | Performance Score | Relationship Score | Hours of Sleep | Meeting |
| |
| |
ID | |
Date | Physical Score | Academic Score | Performance Score | Relationship Score | Hours of Sleep | Meeting |
| |
| |
ID | |
Date | Physical Score | Academic Score | Performance Score | Relationship Score | Hours of Sleep | Meeting |
| |
$value)
{
//echo $value." ";
//echo 'The value of $_SESSION['."'".$key."'".'] is '."'".$value."'".' ';
}*/
}
}?>
|