Bonjour je vien de trouver un probleme il n'affiche pas de ligne

jawadov11 Messages postés 39 Date d'inscription   Statut Membre Dernière intervention   -  
jawadov11 Messages postés 39 Date d'inscription   Statut Membre Dernière intervention   -
Bonjour,

voici mon code:
<?php
$cin="";
$cin=$_GET['cin'];



$result=$mysqli->query("SELECT * FROM affection_cancereuse where cin ='$cin' " )or die($mysqli->error);
if(mysqli_num_rows($result)!=0){
$row=$result->fetch_array();
?>

<?php

$row = $result->fetch_assoc() ?>

<?php

while($row = $result->fetch_assoc()): ?>
<thead> <tr >

<td><?php echo $row['motif_consultation']; ?></td>
<td><?php echo $row['date_consultation']; ?></td>
<td><?php echo $row['antecedents']; ?></td>
<td><?php echo $row['examen_clinique']; ?></td>
<td><?php echo $row['bilan_paraclinique']; ?></td>
<td><?php echo $row['diagnostique']; ?></td>
<td><?php echo $row['reference']; ?></td>
<td><?php echo $row['devenir']; ?></td>



</tr>
</thead>
<?php endwhile;


?>


Configuration: Windows / Chrome 78.0.3904.108
A voir également:

1 réponse

Reivax962 Messages postés 3672 Date d'inscription   Statut Membre Dernière intervention   1 011
 
Bonjour,

Dans ton code, tu fais deux $row = $result->fetch_xxx() avant ton while.
Du coup Php aura déjà avancé de deux lignes dans ton tableau avant de commencer l'affichage, et donc, si tu as moins de trois lignes dans ton résultat, il n'y a plus rien à afficher. Et s'il y a trois lignes ou plus, les deux premières seront ignorées.
Enlève donc ces deux $row = $result->fetch_xxx(), et ne garde que celui du while...

Xavier
1
jawadov11 Messages postés 39 Date d'inscription   Statut Membre Dernière intervention  
 
merci beaucoup
0