PROJET-WEB_STRI1A/WEB/ressources/ville.php
2019-05-22 00:10:25 +02:00

11 lines
441 B
PHP

<?php
require_once ('../connexionBD.php');
//Envoyer en json les villes correspondantes au champ de saisie pour les villes
if (isset($_GET['search'])){
$ville = strtolower(htmlentities(pg_escape_string ($_GET['search'])));
$result = pg_query_params($db, "SELECT codepostal, nomville FROM ville WHERE lower(nomVille) like lower($1);", array("%$ville%"));
$return_arr = pg_fetch_all($result);
echo json_encode($return_arr);
}