bonsoir j'ai un problème avec mon moteur de recherche qui m'affiche bien le résultat, mais me pousse tout ce qui est à la suite ; en gros ça veut pas me l'afficher par dessus mes autres instructions.Re et merci j'ai ajouter le code html ,et j'ai rien trouver par rapport au balise tout a l'air correct ou pas?
HTML
moteur
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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<body> <div id="top_bar"> <header> <div id="titre principal"> <a href="interface.php?page=interface"><img src="images/logo44.png" alt="logo 32" id="logo" /></a> <h4>Bienvenu <?php echo utf8_encode($username);?> </h4> </div> <nav> <ul> <li><a href="#"><strong>Amis</strong></a></li> <li><a href="#"><strong>Membres</strong></a></li> </ul> </nav> </header> </div> <div class="main_menu"> <a href="modifier.php"><strong>Modifier votre profil</strong></a><br/><br/><br/> <img src="images/mail.ico" width="25" height="25" alt=""> <a href="pages/mail.php"><strong>Messages</strong></a><br/> </div> <div class="footer"> <a href="">© #</a> <a href="#">Conditions</a><br/> <a href="#">Support</a> </div> </div> </section> </body> </html>
function
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 <?php include ('function.php'); ?> <form method="post" action=""> <input type="text" name="search" id="search" placeholder="Rechercher..."> <input type="submit" name="submit" id="search" value="rechercher"> </form> <?php if(isset($_POST['submit'])){ @$search = mysql_real_escape_string(htmlspecialchars(trim($_POST['search']))); if(empty($search)){ }else if(strlen($search) ==1){ echo"<span class='erreur'>mot clé de recherche trop court</span>"; }else{ results($search); } } ?> <a href="#"><strong>Amis</strong></a> <a href="#"><strong>Membres</strong></a> <a href="#"><strong>Déconnexion</strong></a> </div> </header> </div>
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 <?php function results($search){ $where = ""; $search = preg_split('/[\s\-]/',$search); $count_keywords = count($search); foreach($search as $key=>$searches){ $where .= "username LIKE'%$searches%'"; if($key != ($count_keywords-1)){ $where .=" AND "; } } @$query = mysql_query("SELECT * FROM login WHERE $where"); @$rows = mysql_num_rows($query); if($rows){ while($username = mysql_fetch_assoc($query)){ echo "<li class='resultat'><a href='#'><strong>".$username['username']."</a></li>"; } }else{ echo"Aucun résultat trouvé..."; } } ?>
voila merci d'avance pour ceux qui m'aideront.
Partager