Codice PHP:
<?php
include '../session.inc';
include (
"../conf.php");
$agno $_SESSION['annosuccessivo'];
$oggi $_SESSION['giornata'];

$connessione =  mysql_connect($server$utente$parolina) or die ("Niente da fare, prova più tardi!!!");
$datab mysql_select_db ($archivio$connessione) or die ("Niente da fare, prova più tardi!!!");

$calciatori "select * from _calciatori08_09";
$carriera "select * from _annuario where anno = '$agno' and squadra <> ''";

$ncalciatori mysql_query($calciatori);
$ncarriera mysql_query($carriera);

$a 0;
$b 0;
while (
$cal mysql_fetch_array($ncalciatori)){
    
$nome[] = $cal['nome'];
    
$num1 $cal['num1'];
    
$num2 $cal['num2'];
    
$squadra1 $cal['sq1'];
    
$squadra2 $cal['sq2'];
    
$giornata[] = $cal[$oggi];
    
$a +=1;
}

while (
$car mysql_fetch_array($ncarriera)){
    
$numA[] = $car['numero'];
    
$nomeA[] = $car['nome'];
    
$years[] = $car['anno'];
    
$squadraA[] = $car['squadra'];
    
$partiteA[] = $car['partite'];
    
$retiA[] = $car['reti'];
    
$serie[] = $car['serie'];
    
$b +=1;
}

$text "presenze.txt";
$s 1;
if (
file_exists($text)) { 
    
$handle fopen($text"r");
    while(!
feof($handle)){
        
$text fgets($handle);
        
$pieces[$s] = explode(";"$text);
        
$tot[$s] = array($pieces[$s][0], $pieces[$s][1], $pieces[$s][2], $pieces[$s][3], $pieces[$s][4], $pieces[$s][5], $pieces[$s][6], $pieces[$s][7]);
        
$s++;
    }
    @
fclose($handle);
} else { 
    echo 
"Attualmente non ci sono aqqiornamenti
"
;
    exit;
}
sort($tot);
/*
for ($y = 0; $y <= $s - 2; $y++){
    echo $y + 1, " - ";
    echo @$tot[$y][0], " - "; //Id
    echo @$tot[$y][1], " - "; //nome
    echo @$tot[$y][2], " - "; //sq1
    echo @$tot[$y][3], " - "; //sq2
    echo @$tot[$y][4], " - "; //presenze
    echo @$tot[$y][5], " - "; //reti
    echo @$tot[$y][6], " - "; //rigori
    echo @$tot[$y][7], "
"; //autogol
}
*/

for ($w 0$w <= $a 1$w++){
    for (
$y 0$y <= $s 2$y++){
        if(
$tot[$y][1] == $nome[$w]){
            echo @
$tot[$y][0], " - ";
            echo @
$tot[$y][1], " - ";
            echo @
$nome[$w], "
"
;
            
$present "update _calciatori08_09 set $oggi='X', reti=$tot[$y][5], rigori=$tot[$y][6], autogol=$tot[$y][7] where Id=$w + 1";
            
$presenza mysql_query($present);
        }
    }
}
mysql_close($connessione);
?>