/
recherche.php
52 lines (43 loc) · 1.26 KB
/
recherche.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
$titrPage = "resultats googleForc3";
include "header.php";//affichage
include "fonctions.php";
if (isset($_GET['page']))
{
$page= htmlentities(strip_tags($_GET['page']));
}
else $page = 1;
$fin = 20;
$debut= $fin * ($page - 1);
$motCle = htmlentities(strip_tags($_GET['search']));
$requete = "SELECT codeInsee AS 'Code INSEE',
codePostal AS 'Code Postal',
nomCommune AS 'Nom de la Commune',
Libelle AS 'Libelle Postal'
FROM webforce3.insee
WHERE nomCommune LIKE ?
LIMIT ".$debut.", ".$fin;
// limit 0,10"
//'".$motCle."'"
require_once "connexion.php";
$curseur = $dbh->prepare($requete);
$curseur->execute(array('%'.$motCle.'%'));
/************
*affichage nbr de pages (version bruno)
*
*
/*************/
$resultatRecherche = $curseur->fetchAll(PDO::FETCH_ASSOC);
echo '<div>'.afficheTableau2D($resultatRecherche).'</div>';
if($page > 1)
{
echo '<button onclick="document.location.href=\'recherche.php?page='.
($page-1).'&search='.$_GET['search'].'\';"><<</button>';
}
if(count($resultatRecherche)==$fin)
echo '<button onclick="document.location.href=\'recherche.php?page='.
($page+1).'&search='.$_GET['search'].'\';">>></button>';
echo '<br/>','<br/>';
echo '<a href="googleforce3.php">Autre recherche</a>';
include "footer.php";
?>