Page 1 sur 1

Navigation par lettres avec liens ou pas

Posté : 01 sept. 2005, 23:10
par djavet
Hello

J'aimerai faitre une naviagtion pour un gestionnaire d'organisation comme ceci:
A B C D E F G H I J K etc...

J'utilise Dreamweaver mx2004, php, et mysql.
J'ai essayé cela :

Code : Tout sélectionner

<?php require_once('../../Connections/connect.php'); ?> <?php mysql_select_db($database_connect, $connect); $query_rsInitials = "SELECT DISTINCT UPPER(LEFT(organisation,1)) FROM contacts ORDER BY organisation ASC"; $rsInitials = mysql_query($query_rsInitials, $connect) or die(mysql_error()); $row_rsInitials = mysql_fetch_assoc($rsInitials); $totalRows_rsInitials = mysql_num_rows($rsInitials); ?> <html> <head> <title>Untitled Document</title> </head> <body> <?php $alphabet=('A B C D E F G H I J K L M N O P Q R S T U V W X Y Z'); while ($r=mysql_fetch_array($rsInitials)) { $initial=$r['organisation']; $links=str_replace("$initial","<a href=\"$initial.php\">$initial</a>",$alphabet); } echo("$links"); ?> </body> </html> <?php mysql_free_result($rsInitials); ?>
Mias je reçois pour chaque lettres cette ligne d'erreur et le menu ne se fait pas.
Notice: Undefined index: organisation in g:\elce\www.website.ch\cms\address\letters.php on line 18
C'est grave docteur?

Merci d'avance de votre aide et temps.

Dom

Posté : 02 sept. 2005, 11:47
par Tho
"SELECT DISTINCT UPPER(LEFT(organisation,1)) FROM contacts ORDER BY organisation ASC"

Le nom de ta colonne s'appelle UPPER(LEFT(organisation,1)) (tu peux le voir dans phpmyadmin).
Renomme-le dans ta requête :

"SELECT DISTINCT UPPER(LEFT(organisation,1)) AS organisation FROM contacts ORDER BY organisation ASC"