/[openfoncier]/trunk/app/findArchitecte.php
ViewVC logotype

Contents of /trunk/app/findArchitecte.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 6929 - (show annotations)
Thu Jun 15 16:57:15 2017 UTC (7 years, 7 months ago) by softime
File size: 1516 byte(s)
* Merge de la 4.2.0

1 <?php
2 /**
3 * Ce script a pour objet de recuperer la liste des pétionnaires correspondant aux critères de recherche
4 *
5 * @package openfoncier
6 * @version SVN : $Id: findArchitecte.php 4418 2015-02-24 17:30:28Z tbenita $
7 */
8
9 require_once "../obj/utils.class.php";
10 $f = new utils("nohtml");
11 $f->isAccredited(array("donnees_techniques","donnees_techniques_modifier","donnees_techniques_ajouter"), "OR");
12 //Récupération des valeurs envoyées
13 $f->set_submitted_value();
14 // Donnees
15 $nom = ($f->get_submitted_post_value("nom") != null) ? $f->get_submitted_post_value("nom") : "";
16 $nom = str_replace('*', '', $nom);
17 $nom = $f->db->escapeSimple($nom);
18
19 $prenom = ($f->get_submitted_post_value("prenom") != null) ? $f->get_submitted_post_value("prenom") : "";
20 $prenom = str_replace('*', '', $prenom);
21 $prenom = $f->db->escapeSimple($prenom);
22
23 $listData = "";
24
25 $f->disableLog();
26
27 $requete = "frequent is TRUE AND";
28 if($nom != "") {
29 $requete .= " nom ILIKE '%$nom%'";
30 $requete .= " AND";
31 }
32 if($prenom != "") {
33 $requete .= " prenom ILIKE '%$prenom%'";
34 $requete .= " AND";
35 }
36
37 $requete = substr($requete, 0, (strlen($requete)-4));
38
39 $sql =
40 "SELECT
41 architecte as value,".
42 "trim(concat(nom,' ', prenom, ' ', ".
43 " cp, ' ', ville)) as content ".
44 "FROM ".DB_PREFIXE."architecte WHERE ".$requete;
45
46 $res = $f->db->query($sql);
47 $f->isDatabaseError($res);
48 $listData=array();
49 while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)) {
50 $listData[] = $row;
51 }
52
53 echo json_encode($listData);
54
55 ?>

Properties

Name Value
svn:keywords "Id"

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26