Bonjour,
j'ai un bout de script, qui devrai boucler, mais il ne m'affiche qu'un seul résultat "le dernier" sur trois ?
donc les menus on un champ commun nommé rubrique et quand j'affiche des echo sa fonctionne ?
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 function menu() { $reponse = new xajaxResponse(); $req="SELECT * FROM pages where rubrique='accueil'"; $result = mysql_query($req); if (!$result) return false; while($affiche = mysql_fetch_assoc($result)){ $txt= '<li>'; $txt.= '<a OnClick="xajax_article(\'' .$affiche['id_article'] . '\');" href="javascript:void(0);"'; $txt.= '>'.$affiche['page'].'</a>'; $txt.= '</li>'; } $reponse->addAssign("menu_conte", "innerHTML", $txt); }
Je ne comprend pas trop ?
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14 function menu() { $req="SELECT id_article, description, page FROM pages where rubrique='accueil'"; $result = mysql_query($req); if (!$result) return false; while($affiche = mysql_fetch_assoc($result)){ echo '<a href="dossier.php?id_article='.$affiche['id_article'].'" title="'.$affiche['description'].'">'.$affiche['page'].' »</a>'; } } menu(); ?>
Merci
Partager