Συγκεντρωτικά Στατιστικά Αθλητή 2

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

// Get a db connection.
$db = JFactory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
$query=’SELECT SUM(HellasScore) AS AllHellasScore, SUM(OthersScore) AS AllOthersScore, COUNT(GameCode) AS AllGames, TeamName FROM game INNER JOIN teams ON game.teamcode=teams.teamcode WHERE game.teamcode=’.$team.’ AND CatCode=’.$category;
$db->setQuery($query);
$results = $db->loadObjectList();

// Get a db connection.
$db2 = JFactory::getDbo();
// Create a new query object.
$query2 = $db->getQuery(true);
$query2=’SELECT COUNT(GameCode) AS Wins FROM game INNER JOIN teams ON game.teamcode=teams.teamcode WHERE HellasScore>OthersScore AND game.teamcode=’.$team.’ AND CatCode=’.$category;
$db2->setQuery($query2);
$results2 = $db2->loadObjectList();

echo “<h1>Αντίπαλος: “.$results[0]->TeamName.”</h1>”;
echo “<p>Αριθμός αγώνων: “.$results[0]->AllGames.” ( “.$results2[0]->Wins.” Νίκες-“.($results[0]->AllGames-$results2[0]->Wins).” Ήττες / Πόντοι υπέρ-κατά: “.$results[0]->AllHellasScore.”-“.$results[0]->AllOthersScore.”, μ.ο. “;
echo number_format($results[0]->AllHellasScore/$results[0]->AllGames,2).”-“.number_format($results[0]->AllOthersScore/$results[0]->AllGames,2).”)”;
?>