Bonjour,
j'ai une requête select qui doit retourner 14 lignes, dans ma page PHP, j'ai mis le code ci-dessous, mais la requête n'affiche qu'une seule ligne, j'ai testé sqlsrv_num_rows pour savoir combien de lignes me retourne la requête ,je trouve toujours 1 comme nombre de lignes.
JE SAIS PAS POURQUOI?
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 <?php $sql="select nomCompte, username,profil,etatInfo from [dbo].[compte] where dateCreation between '".$fdate."' and '".$tdate."' "; $params = array(); $options = array( "Scrollable" => SQLSRV_CURSOR_KEYSET); $stmt = sqlsrv_query($conn, $sql, $params,$options); $row_count = sqlsrv_num_rows($stmt); if ($row_count === false) echo "problème de count row."; else echo $row_count; while($row = sqlsrv_fetch_array($stmt,SQLSRV_FETCH_ASSOC)) {?> <tr> <td><?php echo $cnt;?></td> <td><?php echo $row['nomCompte'];?></td> <td><?php echo $row['username'];?></td> <td><?php echo $row['profil'];?></td> <td><?php echo $row['etatInfo'];?></td> </tr> <?php $cnt=$cnt+1; }?> </tbody> </table> </div> </div> </div>
Partager