Esempio n. 1
0
function addWordToDB($word)
{
    $db = PDO();
    $req = $db->prepare('INSERT INTO wordchallenge VALUES(NULL,?,NULL,NULL)');
    if ($req->execute(array($word))) {
        return true;
    } else {
        return false;
    }
}
Esempio n. 2
0
File: ade.php Progetto: IMR18/web
<?php

if (isset($_GET["action"])) {
    $action = $_GET["action"];
} else {
    $res = array("NO ACTION SET");
    echo json_encode($res);
    exit;
}
require "functions_ade.php";
$db = PDO();
switch ($action) {
    case "updateALL":
        $res = updateRessources($db, ressources2update($db));
        break;
    case "getEvents":
        $ressources = isset($_GET["ressource"]) && !empty($_GET["ressource"]) ? $_GET["ressource"] : "1";
        if ($ressources != '1') {
            $ressources = "'" . implode("','", explode(",", $ressources)) . "'";
        }
        $req = $db->prepare("select * from events where ressource in ({$ressources}) or 1=?");
        $req->execute(array($ressources));
        $res = $req->fetchAll(PDO::FETCH_ASSOC);
        break;
    case "getEventsJson":
        $ressources = isset($_GET["ressource"]) && !empty($_GET["ressource"]) ? $_GET["ressource"] : "1";
        if ($ressources != '1') {
            $ressources = "'" . implode("','", explode(",", $ressources)) . "'";
        }
        $req = $db->prepare("select UID as id, StartDate,EndDate,StartTime,EndTime,Title as title,location from events where ressource in ({$ressources}) or 1=?");
        $req->execute(array($ressources));