-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgraphique.php
More file actions
39 lines (35 loc) · 1.16 KB
/
graphique.php
File metadata and controls
39 lines (35 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
include_once("includes/AccesBase.php");
include_once("Modeles/fonction.php");
//$idUser= $_SESSION['idUser'];
$idUser=$_GET['user'];
$i=0;
$req=$db->prepare("SELECT Type FROM `test` WHERE idUser='$idUser'");
$req->execute();
$ListeNomDeTest=$req->fetchall();
$cl=array_column($ListeNomDeTest,'Type');//on recupere que la colonne type
$indicateur=false;
$ListeDef=array_unique($cl);//on supprime les valeurs duppliquées
$ListeDef=array_values($ListeDef);//supressions des cases vides
$ListeALL= [];
function delete_col(&$array, $key)//supression des clés
{
// Check that the column ($key) to be deleted exists in all rows before attempting delete
foreach ($array as &$row) { if (!array_key_exists($key, $row)) { return false; } }
foreach ($array as &$row) { unset($row[$key]); }
unset($row);
return true;
}
for($i=0; $i<count($ListeDef); $i++){
$ListeALL[$i]= recupDonn($db,$idUser, $ListeDef[$i]);
}
function recupDonn($db,$idUser, $ty){
$req=selectTest($db,$idUser,$ty)->fetchall();
$data = array();
delete_col($req, '0');
delete_col($req, '1');
$data=$req;
return $data;
}
include_once('Vues/graphique.vue.php');
?>