Salut

Pour finir l'année en beauté, j'aurais besoin qu'on m'enlève une épine du pied ! Donc un grand Merci si vous avez un peu de temps.

En fait l'idée c'est :

J'ai un table avec pour chaque enregistrement une liste de valeurs :

A1, A2, A3, A4, A5, A6
B1, B2, B3, B4, B5, B6
C1, etc ...

Les valeurs 4 de chaque enregistrement sont des dates
Les valeurs 3 sont des couleurs

J'affiche une page pour chaque enregistrement à l'aide de la boucle 1.
Dans chaque page, j'ai une seconde boucle pour afficher un tableau qui liste les couleurs de tous les enregistrements et dont la date est inférieure à la date en cours contenu dans la valeur 4.

Je vous fourni le code ça sera plus clair :


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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
<?php
 
$colname_rsobs = "-1";
if (isset($_GET['id_pat'])) {
  $colname_rsobs = (get_magic_quotes_gpc()) ? $_GET['id_pat'] : addslashes($_GET['id_pat']);
}
mysql_select_db($database_kaerys, $kaerys);
$query_rsobs = sprintf("SELECT id_obs, nom_pat, prenom_pat, adresse_pat, bat_pat, esc_pat, etage_pat, codepostal_pat, ville_pat, datenaiss_pat, iah_pat, datepresc_pat, nom_med, prenom_med, adresse_med, cp_med, ville_med, numfeu_obs, date_obs, mat_obs, pression_obs, masque_obs, numtype_obs, suivitt_obs, intro_obs, corps_obs, procvism_obs, procvisy_obs, procrdv_obs, nom_use FROM tobservances LEFT JOIN tmedecin ON tobservances.numpresc_obs = tmedecin.id_med LEFT JOIN tpatient ON tobservances.numpat_obs = tpatient.id_pat LEFT JOIN tusers ON tobservances.numtec_obs = tusers.id_use LEFT JOIN ttypeinter ON tobservances.numtype_obs = ttypeinter.id_typ WHERE numpat_obs = %s ORDER BY id_obs DESC", $colname_rsobs);
$rsobs = mysql_query($query_rsobs, $kaerys) or die(mysql_error());
$row_rsobs = mysql_fetch_assoc($rsobs);
$totalRows_rsobs = mysql_num_rows($rsobs);
 
$dateobs_rstableobs = "-1";
if (isset($row_rsobs['date_obs'])) {
  $dateobs_rstableobs = (get_magic_quotes_gpc()) ? $row_rsobs['date_obs'] : addslashes($row_rsobs['date_obs']);
}
mysql_select_db($database_kaerys, $kaerys);
$query_rstableobs = sprintf("SELECT * FROM tobservances WHERE date_obs < '%s' ORDER BY tobservances.date_obs DESC", $dateobs_rstableobs);
$rstableobs = mysql_query($query_rstableobs, $kaerys) or die(mysql_error());
$row_rstableobs = mysql_fetch_assoc($rstableobs);
$totalRows_rstableobs = mysql_num_rows($rstableobs);
 
?>
 
<body>
 
 
<?php do { /* Boucle 1 */?> 
 
<table cellspacing="0" height="1050"> <!-- Tableau A4 - Hauteur 1050 Largeur 800 -->
<tr height="80">
<td valign="top" width="600"><img src="../../images/logoairsante.jpg" alt="logo Air sant&eacute;" /></td>
<td width="200" valign="top">Le <?php list($year, $month, $day) = explode("-", $row_rsobs['date_obs']);	echo $row_rsobs['date_obs'] = "$day-$month-$year";?></td>
</tr>
 
 
 
 
<tr height="150">
<td valign="top" width="500">
	<table>
	<tr>
	<td height="150" width="300"><u>Patient :</u><br />
					<b><?php echo $row_rsobs['nom_pat']; ?>&nbsp;<?php echo $row_rsobs['prenom_pat']; ?></b><br />
					<?php echo $row_rsobs['adresse_pat']; ?><br />
					<?php if(!empty($row_rsobs['bat_pat']))
					{
					echo 'Bat :' .$row_rsobs['bat_pat'];
					}?>&nbsp;
					<?php if(!empty($row_rsobs['esc_pat']))
					{
					echo 'Esc :' .$row_rsobs['esc_pat'];
					}?>&nbsp;
					<?php if(!empty($row_rsobs['etage_pat']))
					{
					echo 'Etage :' .$row_rsobs['etage_pat'];
					}?><br />
					<?php echo $row_rsobs['codepostal_pat']; ?>&nbsp;<?php echo $row_rsobs['ville_pat']; ?><br />
					Né le : <?php list($year, $month, $day) = explode("-", $row_rsobs['datenaiss_pat']);	echo $row_rsobs['datenaiss_pat'] = "$day-$month-$year";?>			
	</td>
	</tr>
	<tr>
	</tr>
	</table>
</td>
<td valign="top" width="300">
	<table>
	<tr>
	<td height="150" width="280"><b>Dr&nbsp;<?php echo $row_rsobs['nom_med']; ?>&nbsp;<?php echo $row_rsobs['prenom_med']; ?></b><br />
					<?php echo $row_rsobs['adresse_med']; ?><br />
					<?php echo $row_rsobs['cp_med']; ?>&nbsp;<?php echo $row_rsobs['ville_med']; ?>
	</td>
	</tr>
	</table>
</td>
</tr>
 
 
 
 
<tr height="150">
<td valign="top" width="500">
	<table border="1" cellspacing="0">
	<tr><td width="150">Votre prescription du :</td><td><?php list($year, $month, $day) = explode("-", $row_rsobs['datepresc_pat']);	echo $row_rsobs['datepresc_pat'] = "$day-$month-$year";?></td></tr>
	<tr><td>Matériel :</td><td><?php echo $row_rsobs['mat_obs']; ?></td></tr>
	<tr><td>Pression autopilotée :</td><td><?php echo $row_rsobs['pression_obs']; ?></td></tr>
	<tr><td>Masque :</td><td><?php echo $row_rsobs['masque_obs']; ?></td></tr>
	</table>
</td>
 
<td valign="top" width="300">
	<table>
	<tr><td>I.A.H initial :</td><td><?php echo $row_rsobs['iah_pat']; ?></td></tr>
	<tr><td><b>Suivi du traitement :</b></td><td><?php echo $row_rsobs['suivitt_obs']; ?></td></tr>
	</table>
</td>
</tr>
<tr>
<td valign="top" colspan="2" width="800" height="150">
<p>Docteur,</p>
<p><?php echo $row_rsobs['intro_obs']; ?></p>
<p><?php echo $row_rsobs['corps_obs']; ?></p>
</td>
</tr>
 
<!-- Tableau observances -->
<tr>
 
<td valign="top" colspan="2" width="800" height="150">
  <table>
    <tr>
 
	<td colspan="2" width="200">
 
	      <table border="1" cellspacing="0" width="200">
          <tr><td width="200" height="25"></td></tr>
          <tr><td width="200" height="25">Observance : h/j</td></tr>
          <tr><td width="200" height="25">Evèvements résiduels /h</td></tr>
          </table>    
 
	</td>
 
 
<?php /*Boucle 2*/ while ($row_rstableobs = mysql_fetch_assoc($rstableobs)) { ?>
 
	<td align="left" valign="top"> 
 
  		<table border="1" cellspacing="0" width="60">
    	<tr>
		<td width="60" height="25">		
		<?php
 
// Requete pour obtenir le libellé du type de l'intervention
$colname_rstypelibelle = "-1";
if (isset($row_rsobs['numtype_obs'])) {
  $colname_rstypelibelle = (get_magic_quotes_gpc()) ? $row_rsobs['numtype_obs'] : addslashes($row_rsobs['numtype_obs']);
}
mysql_select_db($database_kaerys, $kaerys);
$query_rstypelibelle = sprintf("SELECT * FROM ttypeinter WHERE id_typ = %s", $colname_rstypelibelle);
$rstypelibelle = mysql_query($query_rstypelibelle, $kaerys) or die(mysql_error());
$row_rstypelibelle = mysql_fetch_assoc($rstypelibelle);
$totalRows_rstypelibelle = mysql_num_rows($rstypelibelle);?>
 
<?php echo $row_rstypelibelle['libelle_typ']; ?></td></tr>
    	<tr><td width="60" height="25"><?php echo $row_rstableobs['obshj_obs']; ?></td></tr>
    	<tr><td width="60" height="25"><?php echo $row_rstableobs['iahresid_obs']; ?></td>
		</tr>
    	</table>
	</td>
 
<?php };?>
 
</tr>
</table>
 
</td>
</tr>
<tr>
<td width="800" valign="top" colspan="2" height="30">
Prochaine visite technique prévue : <?php echo $row_rsobs['procvism_obs']; ?> / <?php echo $row_rsobs['procvisy_obs']; ?>
 
<?php /* echo $query_rstableobs ; */?> 
</td>
</tr>
 
<tr>
<td width="800" valign="top" align="center" colspan="2" height="30">
Mr / Mme   doit vous revoir le <?php list($year, $month, $day) = explode("-", $row_rsobs['procrdv_obs']);	echo $row_rsobs['procrdv_obs'] = "$day-$month-$year";?>
</td>
</tr>
 
 
<tr>
<td width="800" valign="top" colspan="2" height="30">
Nous vous remercions de la confiance que vous nous témoignez, et nous vous prions de recevoir, Docteur, nos salutations distinguées. 
</td>
</tr>
 
 
<tr>
<td valign="top" width="400" height="30">
CHRISTIAN CORDEIRO
</td><td width="400"><?php echo $row_rsobs['nom_use']; ?></td>
 
</tr>
 
</table><br />
<?php } while ($row_rsobs = mysql_fetch_assoc($rsobs)); ?>
 
</body>
</html>
<?php
mysql_free_result($rsobs);
 
mysql_free_result($rstypelibelle);
 
mysql_free_result($rsprescription);
 
mysql_free_result($rstableobs);
?>

MERCI et Bonne Année 2009 ! Avec quelques heures d'avance !