Salut,
je suis en train de développer un script en PHP/MySQL et pour mon besoin j'ai décidé de créer une table temporaire pour effectuer un calcul. Dans mon script PHP je lui post des paramètres que l'on coche par le biais de checkbox.
Pas de problème particulier pour afficher mes données.
Cependant, dès que j'ai rajouté la ligne de la table temporaire, ça m'enregistre que le premier élément du checkbox pas tous les autres![]()
.
Est que quelqu'un aurait une idée de comment résoudre mon problème?
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
45
46
47
48
49
50
51
52
53
54
55 foreach($_POST['admin'] as $categ){ echo "$categ <br/>"; $sql = "select count(distinct `IDPatient`) as Nombre, annee, LesioCIMO from export where LesioCIMO like '".$categ."' and age>=".$age1." group by annee order by annee desc"; $result = mysql_query($sql) or die(mysql_error()); echo "<table border='1'> <tr> <th>Nombre</th> <th>annee</th> <th>LesionCIMO</th> </tr>"; while($row = mysql_fetch_assoc($result)) { echo "<tr>"; echo "<td>" . $row['Nombre'] . "</td>"; echo "<td>" . $row['annee'] . "</td>"; echo "<td>" . $row['LesioCIMO'] . "</td>"; echo "</tr>"; } echo "</table>"; echo "<br/><br/>"; //creation d'une table temporaire// mysql_query("CREATE TEMPORARY TABLE sumgliomeyear (nombre int(11), LesioCIMO varchar(20), annee varchar(20))") OR DIE ("Erreur insertion temp table"); $somall = "insert into sumgliomeyear (select count(distinct `IDPatient`), LesioCIMO, annee from export where LesioCIMO like '".$categ."' and `IDPatient` not like '@%' and age>=".$age1." group by annee order by annee desc)"; mysql_query($somall) OR DIE ("Erreur insertion temp table"); $showresult =mysql_query("select sum(nombre) as somme, annee from sumgliomeyear group by annee"); echo "<table border='1'> <tr> <th>Nombre</th> <th>annee</th> </tr>"; while($rowz = mysql_fetch_assoc($showresult) or exit(mysql_error())) { echo "<td>" . $rowz['somme'] . "</td>"; echo "<td>" . $rowz['annee'] . "</td>"; echo "</tr>"; } echo "</table>"; //Fin du test// }//fin du foreach
Partager