Bonjour,
Je désire filtrer un ensemble avec deux ou 3 critères.
Je m'explique:
Je veux la liste des personnes dont le nom commence par ADJ ou VEI
voici mon code:
Si je fais un seul $motclef, cela marche mais sur 1 critère
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
42
43
44 <a href="newabs.php">Revenir à la page des modifications globales</a> <form action="newabs.php" method="post"><br> <input type="text" onFocus="motclef.style.backgroundColor='yellow'" onBlur="motclef.style.backgroundColor='white'" name="motclef" value="<?php echo $_REQUEST['$motclef1%']; ?>"> <input type="text" onFocus="motclef.style.backgroundColor='yellow'" onBlur="motclef.style.backgroundColor='white'" name="motclef" value="<?php echo $_REQUEST['$motclef2%']; ?>"> <input type="submit" value="1) Rechercher un élève par le nom (ou tapez les 3 premières lettres), par le numéro de l'absence ou par la classe OU cliquez sur ce bouton pour avoir TOUS les élèves"><br> </form> <table border="1"> <tr> <td width=''>NOM</td> <td width=''>PRENOM</td> <td width=''>CLASSE</td> <td width=''>JUSTIFICATION</td> <td width=''>Justifiée & légitime ?</td> <td width=''><b>Quand</b></td> <td width=''>de</td> <td width=''>A</td> <td width=''>Total</td> <td width=''>Numéro</td> </tr> <?php if (isset($motclef1) or isset($motclef2) ) { $dateencours=$motclef1; $clause = " WHERE elenom like '$motclef1%' or elenom like '$motclef2%' or elenom like '$motclef1%' or Numero like '$motclef1%' or divcod like '$motclef1%' "; } $orderby = " ORDER BY elenom"; $sql = "SELECT * FROM ges_abs " . $clause . $orderby; $resultat = mysql_query ($sql); echo $sql; echo ''; while ($eleve = mysql_fetch_array ($resultat)) { suite du code bien sûr......
comment avoir sur les deux noms par ex ? en espérant être clair....
merci
Partager