Bonjour à tous,

J'ai un souci concernant l'affichage d'une requête où il me manque la première ligne à chaque fois.
Ça doit être une connerie mais je ne vois pas d'où ça vient.

Mon code :
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
<body>
	<?php
	if (!isset($_POST['submit'])){ ?>
		<form action="" method="POST">
		<div class="col-md-6">
			<div class="row">
				<div class="col-md-6">
					<div class="form-group has-feedback">
						<select class="form-control" width="100px" name="select1" id="choix" ><?php
							$req = $bdd->prepare("SELECT DISTINCT Semaine FROM feuilles_heure");
							$req->execute();
								$resultatCM = $req->fetch();
								?><br><?php
								//echo $resultat['ID'];
								if (!$resultatCM)
								{
									echo "Un problème est survenue";
								} else {
									echo " ça passe";
								while ($resultatCM = $req->fetch())
									{ ?>
										<option style="clear:both;color:blue;width:100px" value="<?php echo $resultatCM['Semaine'] ?>"><?php echo "Semaine | ".$resultatCM['Semaine'] ?></option><?php
									}
								}
								$req=null;?>
						</select>
					</div>
				</div>
			</div>
			<input type="submit" name="submit" value="Valider">
			</div>
		</form>
	<?php
	} else {
		echo $_POST['select1'];
		$req = $bdd->prepare("SELECT * FROM feuilles_heure WHERE Semaine= :Val1");
		$req->execute(array(
		':Val1'=> $_POST['select1'],
		));
			$resultat = $req->fetch();
			?><br><?php
			//echo $resultat['ID'];
			if (!$resultat)
			{
				echo "Un problème est survenu";
			} else {
				echo " ça passe";?>
				<table>
				  <tr>
					<th>ID</th>
					<th>N° Dossier</th>
					<th>Nom</th>
					<th>Ville</th>
					<th>Date</th>
					<th>Temps</th>
					<th>semaine</th>
					<th>A facturer</th>
				  </tr><?php
			while ($resultat = $req->fetch())
			//foreach($resultat as $row)
				{ ?>
				  <tr>
					<td><?php echo $resultat['ID'] ?></td>
					<td><?php echo $resultat['Dossier'] ?></td>
					<td><?php echo $resultat['Nom'] ?></td>
					<td><?php echo $resultat['Ville'] ?></td>
					<td><?php echo $resultat['DateR'] ?></td>
					<td><?php echo $resultat['Temps'] ?></td>
					<td><?php echo $resultat['Semaine'] ?></td>
				  </tr>
					<?php
				}?>
			</table><?php
			}
			$req=null;
}
Ma base de données :
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
 
 
--
-- Structure de la table `feuilles_heure`
--
 
CREATE TABLE IF NOT EXISTS `feuilles_heure` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `Dossier` text NOT NULL,
  `Nom` text NOT NULL,
  `Ville` text NOT NULL,
  `DateR` date NOT NULL,
  `Temps` double NOT NULL,
  `Semaine` text NOT NULL,
  PRIMARY KEY (`ID`),
  KEY `ID` (`ID`),
  KEY `ID_2` (`ID`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ;
 
--
-- Contenu de la table `feuilles_heure`
--
 
INSERT INTO `feuilles_heure` (`ID`, `Dossier`, `Nom`, `Ville`, `DateR`, `Temps`, `Semaine`) VALUES
(1, 'rt17de1606001', '', '', '2016-07-08', 8, '0'),
(2, 'rt17de1606001', '', '', '2016-07-08', 8, '0'),
(3, 'dkmqskdjq', 'autre', 'LRY', '2016-07-14', 8, '28-2016'),
(4, 'mljfsmqlskd', 'fr', 'ju', '2016-07-06', 8, '27-2016'),
(5, 'hh', 'kk', 'll', '2016-06-26', 9, '26-2016'),
(6, 'fsfs', 'dfg', 'gg', '2016-06-26', 4, '26-2016');
 
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
Le résultat de la requête :
Nom : Capture.PNG
Affichages : 121
Taille : 142,2 Ko

Merci pour vos réponses.

Olivier