Beispiel #1
0
    function addUser($usrData)
    {
        $count = 0;
        $fields = '';
        foreach ($usrData as $col => $val) {
            if ($count++ != 0) {
                $fields .= ', ';
            }
            $col = mysql_real_escape_string($col);
            $val = mysql_real_escape_string($val);
            $fields .= "`{$col}` = {$val}";
        }
        $query = "INSERT INTO `myTable` SET {$fields};";
    }
} elseif ($_GET['action'] == 'supprimer_planning') {
    $supprimer_planning = requetemysql::supprimer_planning(array('choix_categorie' => $_POST['choix_categorie'], 'debut' => $_POST['date_debut'], 'fin' => $_POST['date_fin']));
    echo $supprimer_planning;
} elseif ($_GET['action'] == 'recup_point') {
    $liste_point_perso = requetemysql::liste_point(array('permission' => $_SESSION['login'], 'debut' => $_POST['date_debut'], 'fin' => $_POST['date_fin'], 'choix_planning' => $_POST['choix_planning']));
    echo json_encode($liste_point_perso);
} elseif ($_GET['action'] == 'recherche_next_der') {
    $liste_recherche = json_decode($_POST['liste_recherche'], true);
    while (list($key, $value) = each($liste_recherche)) {
        $recherche_der_garde = requetemysql::recherche_der_garde(array('permission' => $_SESSION['login'], 'login' => $value['login'], 'date_actu' => $_POST['date_actu']));
        $liste_recherche[$key]['date_der'] = $recherche_der_garde[0]['date'];
        $recherche_next_garde = requetemysql::recherche_next_garde(array('permission' => $_SESSION['login'], 'login' => $value['login'], 'date_actu' => $_POST['date_actu']));
        $liste_recherche[$key]['date_next'] = $recherche_next_garde[0]['date'];
    }
    echo json_encode($liste_recherche);
} elseif ($_GET['action'] == 'recup_point3') {
    $liste_point = requetemysql::liste_pointv2(array('permission' => $_SESSION['login'], 'debut' => $_POST['debut'], 'fin' => $_POST['fin'], 'fonction' => $_POST['fonction'], 'horaires' => $_POST['horaires'], 'membre' => $_POST['membre'], 'moment' => $_POST['moment']));