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

Fermé
jawadov11 Messages postés 40 Date d'inscription lundi 27 mai 2019 Statut Membre Dernière intervention 6 juin 2020 - 12 déc. 2019 à 10:55
jawadov11 Messages postés 40 Date d'inscription lundi 27 mai 2019 Statut Membre Dernière intervention 6 juin 2020 - 12 déc. 2019 à 11:03
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 3671 Date d'inscription jeudi 16 juin 2005 Statut Membre Dernière intervention 11 février 2021 1 011
12 déc. 2019 à 11:00
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 40 Date d'inscription lundi 27 mai 2019 Statut Membre Dernière intervention 6 juin 2020
12 déc. 2019 à 11:03
merci beaucoup
0