Σελίδα Προπονητή

<?php
$jinput = JFactory::getApplication()->input;
$coachid = $jinput->get(‘coachid’);

// Get a db connection.
$db = JFactory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
$query=’SELECT * FROM coaches WHERE Code=’.$coachid;
$db->setQuery($query);
$results = $db->loadObjectList();

echo “<h1>”.$results[0]->Name.”</h1>”;
//— if (!empty($results[0]->Bio)) { echo “<br>”.$results[0]->Bio.”<br>”; }

//——— First game as HeadCoach ——————————-
// Get a db connection.
$db1 = JFactory::getDbo();
// Create a new query object.
$query = $db1->getQuery(true);
$query=”SELECT HellasScore, OthersScore, TeamName, Category, DATE_FORMAT( game.GameDate, ‘%d-%m-%Y’ ) AS GameDate FROM (game INNER JOIN teams ON game.teamcode=teams.teamcode) INNER JOIN categories ON game.CatCode=categories.CatCode WHERE game.HeadCoach=”.$coachid.” ORDER BY game.GameDate ASC LIMIT 1″;
$db1->setQuery($query);
$results1 = $db1->loadObjectList();

//——— Last game as HeadCoach ——————————-
// Get a db connection.
$db2 = JFactory::getDbo();
// Create a new query object.
$query = $db2->getQuery(true);
$query=”SELECT HellasScore, OthersScore, TeamName, Category, DATE_FORMAT( game.GameDate, ‘%d-%m-%Y’ ) AS GameDate FROM (game INNER JOIN teams ON game.teamcode=teams.teamcode) INNER JOIN categories ON game.CatCode=categories.CatCode WHERE game.HeadCoach=”.$coachid.” ORDER BY game.GameDate DESC LIMIT 1″;
$db2->setQuery($query);
$results2 = $db2->loadObjectList();

//——— First game as AssistantCoach ——————————-
// Get a db connection.
$db3 = JFactory::getDbo();
// Create a new query object.
$query = $db3->getQuery(true);
$query=”SELECT HellasScore, OthersScore, TeamName, Category, DATE_FORMAT( game.GameDate, ‘%d-%m-%Y’ ) AS GameDate FROM (game INNER JOIN teams ON game.teamcode=teams.teamcode) INNER JOIN categories ON game.CatCode=categories.CatCode WHERE game.Assistant1=”.$coachid.” OR game.Assistant2=”.$coachid.” ORDER BY game.GameDate ASC LIMIT 1″;
$db3->setQuery($query);
$results3 = $db3->loadObjectList();

//——— Last game as AssistantCoach ——————————-
// Get a db connection.
$db4 = JFactory::getDbo();
// Create a new query object.
$query = $db4->getQuery(true);
$query=”SELECT HellasScore, OthersScore, TeamName, Category, DATE_FORMAT( game.GameDate, ‘%d-%m-%Y’ ) AS GameDate FROM (game INNER JOIN teams ON game.teamcode=teams.teamcode) INNER JOIN categories ON game.CatCode=categories.CatCode WHERE game.Assistant1=”.$coachid.” OR game.Assistant2=”.$coachid.” ORDER BY game.GameDate DESC LIMIT 1″;
$db4->setQuery($query);
$results4 = $db4->loadObjectList();

if (!empty($results1[0]->TeamName)) {
echo “<p>Πρώτος αγώνας ως <b>HeadCoach</b> ήταν στον πάγκο της ΕΘΝΙΚΗΣ “.$results1[0]->Category.” και στον αγώνα ΕΛΛΑΔΑ-“.$results1[0]->TeamName.” “.$results1[0]->HellasScore.”-“.$results1[0]->OthersScore.”, στις “.$results1[0]->GameDate.”, ενώ ο πιο πρόσφατος αγώνας ήταν στον πάγκο της ΕΘΝΙΚΗΣ “.$results2[0]->Category.” και στον αγώνα ΕΛΛΑΔΑ-“.$results2[0]->TeamName.” “.$results2[0]->HellasScore.”-“.$results2[0]->OthersScore.”, στις “.$results2[0]->GameDate.”</p>”; }

if (!empty($results3[0]->TeamName)) {
echo “<p>Πρώτος αγώνας ως <b>Assistant Coach</b> ήταν στον πάγκο της ΕΘΝΙΚΗΣ “.$results3[0]->Category.” και στον αγώνα ΕΛΛΑΔΑ-“.$results3[0]->TeamName.” “.$results3[0]->HellasScore.”-“.$results3[0]->OthersScore.”, στις “.$results3[0]->GameDate.”, ενώ ο πιο πρόσφατος αγώνας ήταν στον πάγκο της ΕΘΝΙΚΗΣ “.$results4[0]->Category.” και στον αγώνα ΕΛΛΑΔΑ-“.$results4[0]->TeamName.” “.$results4[0]->HellasScore.”-“.$results4[0]->OthersScore.”, στις “.$results4[0]->GameDate.”</p>”; }

?>