Example #1
0
function MoyennePersoGlissante($nb_copies)
{
    $db = masterDB::getDB();
    $req = $db->prepare("SELECT mark FROM units WHERE id_corrector = ? ORDER BY date_modif DESC ");
    $req->execute(array($_SESSION["id"]));
    $compteur = 0;
    $indice = 0;
    while ($res = $req->fetch() and $indice < $nb_copies) {
        echo $res[0];
        $compteur += $res[0];
        $indice += 1;
    }
    return $compteur / $indice;
}
Example #2
0
<?php

include_once "../master_db.php";
$db = masterDB::getDB();
echo "<h2>Database builder : </h2>";
$tableFile = fopen("tables_struct", "r");
while ($line = fgets($tableFile)) {
    $db->query("CREATE TABLE IF NOT EXISTS " . $line);
    echo "Creating : " . $line . "<br>";
}
fclose($tableFile);
echo "<h4>Done</h4>";