Précédent   Forum des professionnels en informatique > PHP > PHP & SGBD
PHP & SGBD Forum d'entraide sur les SGBD avec PHP. Avant de poster : FAQ BDD, toutes les FAQ PHP, cours BDD et sources BDD
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 24/05/2008, 21h28   #1
Invité de passage
 
Inscription : mai 2008
Messages : 6
Détails du profil
Informations forums :
Inscription : mai 2008
Messages : 6
Points : 1
Points : 1
Par défaut Moteur de recherche

Salut a tous,
Voila mon problème, Je souhaite faire un moteur de recherche pour mon site.
L'adresse du site c'est http://www.natgraphics.oniriquefacto...ilis/index.php si vous voulais voir à quoi ça ressemble.
C'est un site pour une agence immobilière.
Voila je voudrais faire un code pour le moteur de recherche dans ma base de données sur plusieurs table. mon site est écrit en php.
Merci d'avance pour vos réponses.


Je vous mets mon code néanmoins mon code pour la page sur laquelle je voudrais effectuer la recherche :

Code :
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
<!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=iso-8859-1" />
<title>Immobilis-achat</title>
<link href="css/navigation.css" rel="stylesheet" type="text/css" />
<link href="css/achat_recherche.css" rel="stylesheet" type="text/css" />
<link href="css/immo_achat.css" rel="stylesheet" type="text/css" />
</head>
 
<body>
<div id="main">
  <div id="header"></div>
    <div id="navigation"> 
  <?php include('include/nav_achat.inc.php'); ?>
  </div>
 
    <div id="achat_gauche">
	<div id="texte_gauche_vente">
	Bienvenue dans le monde de l'immobilier!
	<p>&nbsp;</p>
	<p>Une équipe de professionnels est à votre service, pour vous guider et vous conseiller dans votre projet d'acquérir un bien.</p>
	<p>&nbsp;</p>
	<p>Plusieurs biens vous attendent sur ce site. Insérez les critères de sélection et lancez la recherche.</p>
	<p>&nbsp;</p>
	<p>A vous de jouer, vous n'êtes qu'à un clic de votre bonheur.</p>
	</div>
</div>
<div id="milieu">
		<div id="achat_recherche"><img src="images/achats_photo.jpg"></div>
		<form action="achat.php" method="get" name="recherche" id="recherche">
		<div id="achat_recherche_type">			 
			<table width="175" border="0" cellspacing="5" class="texte_recherche">
	  			<tr>
    			<td>Type de bien immobilier</td>
 				</tr>
  				<tr>
    			<td>
				<select name="Type">
		  			<option>Maison</option>
		  			<option>Appartement</option>
		  			<option>Bungalow</option>
		 			<option>Villa</option>
		  			<option>Espace commercial</option>
		  			<option>Terrain</option>
				</select>
				</td>
  				</tr>
  				<tr>
    			<td>Ville</td>
  				</tr>
  				<tr>
    			  <td><input name="Input" type="text" class="ville" /></td>
  				</tr>
  				<tr>
    			<td>Fourchette de prix</td>
  				</tr>
  				<tr>
    			<td>de&nbsp;Rs.&nbsp;<input name="" type="text" class="prix" size="15" />
    			&nbsp;</td>
  				</tr>
  				<tr>
    			<td>à&nbsp;Rs.&nbsp;&nbsp;&nbsp;<input name="" type="text" class="prix" size="15" /></td>
  				</tr>
			</table>
			<table width="175" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td>&nbsp;</td>
    <td height="45px"><div align="center" ><input name="search" type="button" class="bouton_recherche" id="search" value="Lancez la recherche"/></td>
    <td>&nbsp;</td>
  </tr>
</table>
 
		</div>
		<div id="achat_recherche_options">
			<table width="387" border="0" cellpadding="0" class="texte_recherche">
				<tr>
    				<td width="115">Surface habitable</td>
   				  <td width="70px"><input type="text" class="details" size="2" maxlength="2" /> m2</td>
    				<td>Superficie terrain</td>
    				<td><input type="text" class="details" size="2" maxlength="2" />
    				m2</td>
  				</tr>
  				<tr>
    				<td>Nombre de pi&egrave;ces</td>
    				<td><input type="text" class="details" size="2" maxlength="2" /></td>
    				<td>Chambre &agrave; coucher</td>
    				<td><input type="text" class="details" size="2" maxlength="2" /></td>
  				</tr>
  				<tr>
    				<td>Salle de bains</td>
    				<td><input type="text" class="details" size="2" maxlength="2" /></td>
    				<td>&nbsp;</td>
    				<td>&nbsp;</td>
  				</tr>
		  </table>
 
			<table width="380" border="0" cellpadding="0" class="texte_recherche">
	  			<tr>
    				<td width="10px"></td>
					<td width="70">Balcon</td>
    				<td width="10px"><input name="" type="checkbox" value="" /></td>
					<td width="10px"></td>
    				<td width="140px">Terrasse</td>
    				<td width="10px"><input name="" type="checkbox" value="" /></td>
					<td width="10px"></td>
    				<td width="115px">Etage</td>
    				<td width="10px"><input name="" type="checkbox" value="" /></td>
  				</tr>
  				<tr>
    				<td width="10px"></td>
					<td>Jardin</td>
    				<td width="10px"><input name="" type="checkbox" value="" /></td>
					<td width="10px"></td>
    				<td>Cour cloturé</td>
    				<td width="10px"><input name="" type="checkbox" value="" /></td>
					<td width="10px"></td>
    				<td>Volet</td>
    				<td width="10px"><input name="" type="checkbox" value="" /></td>
  				</tr>
  				<tr>
    				<td width="10px"></td>
					<td>Cave</td>
    				<td width="10px"><input name="" type="checkbox" value="" /></td>
					<td width="10px"></td>
    				<td>Grenier</td>
    				<td width="10px"><input name="" type="checkbox" value="" /></td>
					<td width="10px"></td>
    				<td>Garage</td>
    				<td width="10px"><input name="" type="checkbox" value="" /></td>
  				</tr>
  				<tr>
    				<td width="10px"></td>
					<td>Buanderie</td>
    				<td width="10px"><input name="" type="checkbox" value="" /></td>
					<td width="10px"></td>
    				<td>Climatisé</td>
    				<td width="10px"><input name="" type="checkbox" value="" /></td>
					<td width="10px"></td>
    				<td>Porte auto.</td>
    				<td width="10px"><input name="" type="checkbox" value="" /></td>
  				</tr>
  				<tr>
    				<td width="10px"></td>
					<td>Parquet</td>
    				<td width="10px"><input name="" type="checkbox" value="" /></td>
					<td width="10px"></td>
    				<td>Carrelage</td>
    				<td width="10px"><input name="" type="checkbox" value="" /></td>
					<td width="10px"></td>
					<td>Ascenseur</td>
    				<td width="10px"><input name="" type="checkbox" value="" /></td>
  				</tr>
  				<tr>
    				<td width="10px"></td>
					<td>Piscine</td>
    				<td width="10px"><input name="" type="checkbox" value="" /></td>
					<td width="10px"></td>
    				<td>Système d'alarme</td>
    				<td width="10px"><input name="" type="checkbox" value="" /></td>
					<td width="10px"></td>
					<td>Jaccuzi</td>
    				<td width="10px"><input name="" type="checkbox" value="" /></td>
  				</tr>
		  </table>
 
			<table width="350" border="0" class="texte_recherche" cellpadding="0" cellspacing="0">
  				<tr>
    				<td width="10px"></td>
					<td>Chauffe-eau solaire</td>
    				<td width="10px"><input name="" type="checkbox" value="" /></td>
    				<td>Chauffe-eau électrique</td>
    				<td width="10px"><input name="" type="checkbox" value="" /></td>
  				</tr>
  			</table>
		</div>
	</form>
 
	</div>
 
 
<div id="footer">Copyright Immobilis 2008 &copy; - <a href="mailto:natgraphics2004@yahoo.fr?subject= Feedback Immobilis">Contact Webmaster</a></div>
natgraphics est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 10/06/2008, 18h38   #2
Membre confirmé
 
Avatar de schwarzy2
 
Femme Raphaelle Simonney
Développeur Web
Inscription : septembre 2006
Messages : 454
Détails du profil
Informations personnelles :
Nom : Femme Raphaelle Simonney
Âge : 25
Localisation : France

Informations professionnelles :
Activité : Développeur Web
Secteur : High Tech - Multimédia et Internet

Informations forums :
Inscription : septembre 2006
Messages : 454
Points : 256
Points : 256
ta demande n'est pas très précise...que veux-tu au juste?
__________________
Feel good, feel geek
schwarzy2 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 28/06/2008, 15h54   #3
Membre régulier
 
Avatar de guigouz
 
Guillaume Zurbach
Étudiant
Inscription : mars 2008
Messages : 84
Détails du profil
Informations personnelles :
Nom : Guillaume Zurbach
Âge : 22
Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

Informations professionnelles :
Activité : Étudiant

Informations forums :
Inscription : mars 2008
Messages : 84
Points : 87
Points : 87
Bonsoir...

Généralement, pour les moteurs de recherche de ce type, tu peux te contenter d'une requête SQL paramétrée. Il te suffit de savoir quelle sont les tables concernées par ta requête, de faire tes jointures et de paramétrer les conditions de ta requête pour ne recevoir que les valeurs qui t'intéressent...

Code :
1
2
3
4
5
6
$req = 'SELECT champ1, champ2, ... 
FROM table1, table2, ...
WHERE table1.monId = table2.monId
AND ...
AND tableX.monChamp = '.$maValeur.'
AND ...;';
Voila j'espère avoir été clair et correctement répondu a ta question...
Bonne continuation...
guigouz est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 03/07/2008, 11h01   #4
Invité régulier
 
Inscription : juillet 2008
Messages : 6
Détails du profil
Informations forums :
Inscription : juillet 2008
Messages : 6
Points : 6
Points : 6
oé et tu peus aussi utiliser la fonction

Code :
1
2
3
 
 
like%$find% " ;
alors dans la requete Sql aprés choisir tes table
mr-$oft est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 20h19.


 
 
 
 
Partenaires

Hébergement Web