Exemplo n.º 1
0
    try {
        $req = $bdd->prepare("UPDATE t_user, t_user_role \n                                SET User_Mail = :email, User_Street = :adresse,\n                                ID_City = (SELECT City_ID FROM t_city where City_Name = :ville), User_Phone = :gsm, ID_Role = :role where User_ID = :id and ID_User = User_ID");
        $req->execute(array('adresse' => $_POST["adresse"], 'ville' => $_POST["ville"], 'gsm' => $_POST["gsm"], 'email' => $_POST["email"], 'role' => $_POST["role"], 'id' => $_POST["ValiderModif"]));
    } catch (Exception $e) {
        die('Erreur : ' . $e->getMessage());
    }
}
if (isset($_POST["CSV"])) {
    include '../Fonction/CSV.php';
    try {
        $fichier = new FichierExcel();
        $reponse = $bdd->query("SELECT distinct(User_ID), User_Mail, User_Street, User_Phone, City_Name, ID_Role, Role_Name\n                                FROM t_user \n                                inner join t_user_role on User_ID = ID_User \n                                inner join t_role on Role_ID = ID_Role\n                                inner join t_city on ID_City = City_ID");
        $fichier->Colonne("Id;Email;Adresse;Téléphone;Ville;Role;Etat");
        while ($donnees = $reponse->fetch(PDO::FETCH_ASSOC)) {
            $fichier->Insertion("'" . $donnees["User_ID"] . "';'" . $donnees["User_Mail"] . "';'" . $donnees["User_Street"] . "';'" . $donnees["User_Phone"] . "';'" . $donnees["City_Name"] . "';'" . $donnees["Role_Name"] . "'");
            $fichier->output('ListeUtilisateurs');
        }
    } catch (Exception $e) {
        die('Erreur : ' . $e->getMessage());
    }
}
?>

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
Exemplo n.º 2
0
// Afficher les erreurs à l'écran
ini_set('display_errors', 1);
// Enregistrer les erreurs dans un fichier de log
ini_set('log_errors', 1);
// Nom du fichier qui enregistre les logs (attention aux droits à l'écriture)
ini_set('error_log', dirname(__FILE__) . '/log_error_php.txt');
include "../config.php";
include 'FichierExcel.php';
try {
    $conn = new PDO("mysql:host={$dbhost};dbname={$dbname};charset=utf8", $dbuser, $dbpass);
    $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (PDOException $e) {
    echo "Oops, une erreur est survenue !";
    exit;
}
$i = 0;
$result = $conn->prepare("SELECT * FROM Event");
$result->execute();
$fichier = new FichierExcel();
$fichier->Colonne("Event;Nombre d'inscrit");
$ll = "";
while ($donnees = $result->fetch()) {
    $result3 = $conn->prepare("SELECT * FROM Event_User WHERE ID_event={$donnees['ID']}");
    $result3->execute();
    $rows = $result3->rowCount();
    $fichier->Insertion("{$donnees['Libelle']};{$rows}");
    $ll = $ll . $donnees['Libelle'] . ";";
}
$fichier->output('Event-Stats');
Exemplo n.º 3
0
<?php

$dbhost = "localhost";
$dbname = "Extia_Event";
$dbuser = "******";
$dbpass = "";
include 'FichierExcel.php';
try {
    $conn = new PDO("mysql:host={$dbhost};dbname={$dbname};charset=utf8", $dbuser, $dbpass);
    $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (PDOException $e) {
    echo "Oops, une erreur est survenue !";
    exit;
}
$reponse = $conn->query("SELECT * FROM Event");
$fichier = new FichierExcel();
$fichier->Colonne("Libelle;Description;Region");
while ($donnees = $reponse->fetch()) {
    $fichier->Insertion("{$donnees['Libelle']};{$donnees['Description']};{$donnees['Region']}");
}
$reponse->closeCursor();
$fichier->output('Stats');