<?php
$pagetitle = "AFI stock";
$pagelocation = "../";
include("../asset/include/head.php");
{
$reponse= $bdd->query('SELECT `ref`, `stock` FROM `fournisseur` ');
$donnees = $reponse->fetch();
}
?>
<div style ="background-color: #F7F7F7; width: 100%;box-shadow: 11px 12px 20px -7px rgba(0,0,0,0.21);margin-top: 2em;margin-bottom: 2em; border-radius: 10px" class="p-2";>
<form class="form-inline m-0 p-0">
<div class="form-group mx-sm-3" >
<label for="inputPassword2" class="sr-only">Rechercher</label>
<input type="text" class="form-control" id="inputPassword2" placeholder="Rechercher">
</div>
<button type="submit" class="btn btn-primary mr-3"><i class="fas fa-search"></i> Rechercher</button>
</form>
</div>
<table class="table table-striped text-primary" style="text-align: center; margin-top: 3em;">
<thead>
<tr >
<th style="width: 25%;" scope="col">Référence</th>
<th style="width: 25%;" scope="col">En stock ?</th>
<th style="width: 25%;" scope="col">Date</th>
<th style="width: 25%;" scope="col">Modifié par</th>
</tr>
</thead>
<tbody>
<?php var_dump($donnees);
while($donnees=$reponse->fetch());
{
echo '<tr>
<td> '.$donnees[`ref`].'</td>
<td> '.$donnees[`stock`].'</td>
<td></td>
<td></td>
</tr>
</table>';
$reponse->closeCursor();
}
?>
<?php include("../asset/include/footer.php");?>
mais une erreur s'affiche lors du chargement de la page: Warning: Trying to access array offset on value of type bool in C:\xampp\htdocs\CHR\Stock\afi.php on line 35Warning: Trying to access array offset on value of type bool in C:\xampp\htdocs\CHR\Stock\afi.php on line 36
j'ai vérifié si la variable était vide mais le var_dump m'affiche bien les données contenue dans la table de la bdd: array(4) { ["ref"]=> string(8) "JZH-TC-2" [0]=> string(8) "JZH-TC-2" ["stock"]=> string(3) "oui" [1]=> string(3) "oui" }
Avez vous des idée ?
merci.