-
Notifications
You must be signed in to change notification settings - Fork 0
/
liste_result.php
37 lines (37 loc) · 1.07 KB
/
liste_result.php
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
<?php
require_once("controller.php");
require_once("modelDAO.php");
if(isset($_GET['q'])){
$q = $_GET['q'];
$liste = getListeByCategorie($q);
$arr = array();
$i = 0;
foreach($liste as $result){
$arr[$i]['id'] = $result->id();
$arr[$i]['titre'] = $result->titre();
$arr[$i]['mots'] = $result->listeMot();
$arr[$i]['categorie'] = $result->categorie();
$arr[$i]['categorie2'] = $result->categorie2();
$arr[$i]['pseudo'] = $result->membre();
$i++;
}
echo json_encode($arr);
}elseif(isset($_GET['id'])){
$id = $_GET['id'];
$query = "select * from listes_public where id = '$id'";
$result = mysql_query($query);
if(mysql_num_rows($result) != 0){
$arr = array();
$i = 0;
while($result1 = mysql_fetch_array($result)){
$arr[$i]['id'] = $result1['id'];
$arr[$i]['titre'] = $result1['titre'];
$arr[$i]['mots'] = $result1['liste'];
$arr[$i]['categorie'] = $result1['categorie'];
$arr[$i]['categorie2'] = $result1['categorie2'];
$i++;
}
echo json_encode($arr);
}
}
?>