Bonjour,
Et bien voilà ce code affiche qu'un seul enregistrement...
voir exemple sur mon site, et taper pour mot clef "test" et cocher "article" :
http://www.france-webmaster.fr
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
38
39
40
41 //-->> RECEPTION de $expression //...POST... $expression = sql_regcase("$expression"); //-->> REQUETE $req_resultat_article = "SELECT auteur,nom_article,code_article,mot_clef FROM article WHERE mot_clef REGEXP '".$expression."' OR contenu REGEXP '".$expression."'"; //-->> EXECUTION DE LA REQUETE $selection_resultat_article_req = mysql_query($req_resultat_article) or die (''.mysql_error()); //-->> ADAPTATEUR DE VARIABLE EN BOUCLE $resultat_article_1 = ' <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber2" height="28"> <tr> <td width="5%" height="12" align="center"><font color="#808080" face="Verdana" size="2"></font></td> <td width="15%" height="12" align="center"><font color="#808080" face="Verdana" size="2">Auteur</font></td> <td width="15%" height="12" align="center"><font color="#808080" face="Verdana" size="2">Code article</font></td> <td width="30%" height="12" align="center"><font color="#808080" face="Verdana" size="2">Nom de l\'article</font></td> <td width="35%" height="12" align="center"><font color="#808080" face="Verdana" size="2">Mot clef</font></td> </tr> <tr> '; //-->> GENERATEUR DE VARIABLE while($data_resultat_article_req = mysql_fetch_array($selection_resultat_article_req)) { $resultat_article_2 = ' <td width="5%" height="12" align="center"><p align="center"><img border="0" src="design/image/ICONES/moderna/(24).gif"></p></td> <td width="15%" height="12" align="center"><font color="'.$couleur_text.'" size="'.$taille_text.'" face="'.$police_text.'">'.stripslashes($data_resultat_article_req["auteur"]).' </font></td> <td width="15%" height="12" align="center"><font color="'.$couleur_text.'" size="'.$taille_text.'" face="'.$police_text.'">'.stripslashes($data_resultat_article_req["code_article"]).' </font></td> <td width="30%" height="12" align="center"><font color="'.$couleur_text.'" size="'.$taille_text.'" face="'.$police_text.'">'.stripslashes($data_resultat_article_req["nom_article"]).' </font></td> <td width="30%" height="12" align="center"><font color="'.$couleur_text.'" size="'.$taille_text.'" face="'.$police_text.'">'.stripslashes($data_resultat_article_req["mot_clef"]).' </font></td> '; } $resultat_article_3 = ' </tr> </table> ';
Il devrait y avoir Article de test 1 ET Article de test 2
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 -- -- Structure de la table `article` -- CREATE TABLE `article` ( `auteur` varchar(20) collate latin1_german2_ci NOT NULL, `contenu` longtext collate latin1_german2_ci NOT NULL, `nom_article` varchar(255) collate latin1_german2_ci NOT NULL, `code_article` varchar(255) collate latin1_german2_ci NOT NULL, `mot_clef` varchar(255) collate latin1_german2_ci NOT NULL, PRIMARY KEY (`nom_article`,`code_article`), UNIQUE KEY `nom_article` (`nom_article`,`code_article`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_german2_ci; -- -- Contenu de la table `article` -- INSERT INTO `article` VALUES ('moi', 'Article de test xxxxxxxxxxxxxx', 'Article de test 2', '1556488', 'test'); INSERT INTO `article` VALUES ('moi', 'Article de test xxxxxxxxxxxxxx', 'Article de test 1', '1556487', 'test');
Merci.![]()
Partager