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
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<?php
include ('../configure_file.php');
$KeyWord = $_POST['KeyWord'];
// connection à la DB
$link = mysql_connect ($host,$user,$pass);
// forcer l UTF
mysql_query("SET CHARACTER SET 'utf8';", $link)or die('Erreur: '.mysql_error());
// selection de la DB
mysql_select_db($db) or die ('Erreur: '.mysql_error());
// on selectionne les donnees de la DB pr avoir une page par page
$select2 = "SELECT * FROM ma_table WHERE adresse LIKE '%".$KeyWord."%' ORDER by id DESC";
$result2 = mysql_query($select2,$link) or die ('Erreur : '.mysql_error() );
$total2 = mysql_num_rows($result2);
// si on a récupéré un résultat on l'affiche.
if($total2) {
// on ouvre notre tableau pr afficher le coran
// on extrait les donnees
while ($row2 = mysql_fetch_array($result2)) {
$adresse = $row2['adresse'];
echo 'nbre ' .$total2;
echo $adresse;
}
}
else echo 'aucun resultat pour le mot "' .$KeyWord. '"';
?> |