fbpx

risultati under 15 silver

[insert_php]

// *************************************************************
// Da qui in poi le istruzioni seguenti devono esserci SEMPRE!!!
// *************************************************************

$servername = “hostingmysql01.register.it”;
$username = “SP4273_user”;
$password = “SPa92113”;
$dbname = “spiox_com_campionati”;// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die(“Connection failed: ” . $conn->connect_error);
}
$strSQL = “SELECT * FROM Stagioni WHERE Ultima = -1;”;
$result = $conn->query($strSQL);

$rowStag = $result->fetch_assoc();
$Stag = $rowStag[“Stagione”];

$Lega = $_POST[“Lega”];
if ($Lega == “”)
{
$prima = 1;

// *************************************************************
// INSERIRE QUI SOTTO IL CODICE LEGA !!!!
// *************************************************************
$Lega = “0725”;//***********************************************
// *************************************************************

$pagina = “http://” . $_SERVER[‘SERVER_NAME’] . $_SERVER[‘REQUEST_URI’];
}
else
{
$pagina = $_POST[“pagina”];
}

// *************************************************************
// =============================================================
// *************************************************************

// *************************************************************
// INSERIRE QUI SOTTO IL Tipo report: Risultati, Classifica, Tabellini, …
// *************************************************************

$headPage = “Risultati”;

// *************************************************************
// =============================================================
// *************************************************************

$strSQL = “SELECT * FROM Leghe WHERE Stagione = ‘”.$Stag.”‘ AND ID_Lega = ‘”.$Lega.”‘;”;
$result = $conn->query($strSQL);

// *************************************************************
// Fino a qui le istruzioni precedenti devono esserci SEMPRE!!!
// *************************************************************

if ($result->num_rows > 0) {
$rowLega = $result->fetch_assoc();
$header =”

“.$headPage.” “.$rowLega[“Categoria”].” Gir. “.$rowLega[“Girone”].”

“;
echo $header;
}
else
{
echo “0 results in Leghe”;
}

// Cerca l’ultima partita giocata e, di conseguenza, l’ultima giornata giocata

$strSQL = “SELECT Giornata, Turno, Fase”;
$strSQL .= ” FROM campionati”;
$strSQL .= ” WHERE Stagione = ‘”.$Stag.”‘ AND ID_Lega = ‘”.$Lega.”‘”;
if ($prima == 1)
{
$strSQL .= ” AND Giocata = -1 “;
}
else
{
$strSQL .= ” AND Giornata = ” . $_POST[“giorn”];
}
$strSQL .= ” ORDER BY ID_Gara DESC LIMIT 1;”;

$result = $conn->query($strSQL);

if ($result->num_rows > 0) {
$rowCamp = $result->fetch_assoc();
$gotGiorn = $_POST[“giorn”];
if ($gotGiorn == “”)
{
$Giorn = $rowCamp[“Giornata”];
}
else
{
$Giorn = $gotGiorn;
}
$Turno = $rowCamp[“Turno”];
$FaseC = $rowCamp[“Fase”];
$Prec = $Giorn – 1;
$Succ = $Giorn + 1;
}
else
{
$Giorn = 1;
$Turno = 1;
$FaseC = “And”;
$Succ = $Giorn + 1;
echo “0 results in Campionati”;
}

$nMaxGiorn = $rowLega[“N_Giornate”];

$strSQL = “SELECT *”;
$strSQL .= ” FROM campionati”;
$strSQL .= ” WHERE Stagione = ‘”.$Stag.”‘ AND ID_Lega = ‘”.$Lega.”‘”;
$strSQL .= ” AND Giornata = ‘”.$Giorn.”‘ ORDER BY ID_Gara”;
$strSQL .= “;”;

$result = $conn->query($strSQL);

$gotoGiorn = “

“;

if ($Giorn <> 1)
{
$linkPrec = “

“;
}
else
{
$linkPrec = “

“;
}

if ($Giorn <> $nMaxGiorn)
{
if ($Giorn <> 1)
{
$linkSucc = “

“;
}
else
{
$linkSucc = “

“;
}
}
else
{
$linkSucc = “

“;
}

// echo “

” . $linkPrec . $linkSucc . “

” . “

” . $gotoGiorn . “

“;

// la successiva dev essere sistemata nelle altezze e larghezze per sostituire la precedente
echo “

” . $linkPrec . “
” . $gotoGiorn . “
” . $linkSucc . “

“;

if ($result->num_rows > 0) {

// Inizio Output testata tabella

$contenuto .=”

“;
$contenuto .=”

“;
$contenuto .=”

“;
$contenuto .=”

“;
$contenuto .=”

“;
$contenuto .=”

“;

//visualizzo la tabella

//echo $contenuto;

// output data of each row

while($row = $result->fetch_assoc()){

$contenuto .=”

“;
if ($row[“Vittoria”] == “H”)
{
$contenuto .=”

“;
}
else
{
$contenuto .=”

“;
}

if ($row[“Vittoria”] == “V”)
{
$contenuto .=”

“;
}
else
{
$contenuto .=”

“;
}

$contenuto .=”

“;
$contenuto .=”

“;
$contenuto .=”

“;

if ($row[“Punti_Home”] == 0 AND $row[“Punti_Visit”] == 0)
{
$contenuto .=”

“;
$contenuto .=”

“;
$contenuto .=”

“;
}

}

//chiudo la tabella
$contenuto .= “

Stagione “.$Stag.” – “.$Turno.” Giornata di “.$FaseC.”
“.$row[“Homer”].” “.$row[“Homer”].” “.$row[“Visitor”].” “.$row[“Visitor”].” “.$row[“Punti_Home”].” “.$row[“Punti_Visit”].”
“.date(‘d/m/Y’,strtotime($row[“Data”])).” – “.date(‘H:i’,strtotime($row[“Ora”])).” (“.$row[“Palestra”].”)

“;

//visualizzo la tabella
echo $contenuto;

}

// *************************************************************
// Da qui in poi le istruzioni seguenti devono esserci SEMPRE!!!
// *************************************************************

else
{
echo “0 results”;
}

$conn->close();
[/insert_php]