probleme sous mamp
Posté : 11 févr. 2016, 10:41
Bonjour j ai un problème,une erreur s affiche ds ma page test pour une simple requete ce n est pas la premiere fois que ca me l affiche sous mamp. "Notice: Trying to get property of non-object in /Users/floriansysaykeo/Documents/www/Projet_mould/fichier_test.php on line 6
"
Pouvez vous m aiguiller??
Code : Tout sélectionner
[PHP]
<?php
include_once("connexion.php");
$query = $mysqli -> query("SELECT * FROM mould
ORDER BY date DESC");
$nb = $query -> num_rows;
echo "<h2>Tableau de bord</h2>";
echo "<p>Il y a ".$nb."mould dans la table</p>";
if($nb > 0){
echo "<table>";
echo "<tr>";
echo "<th>Id</th>";
echo "<th>tool_number</th>";
echo "<th>Nb type</th>";
echo "</tr>";
while($row = $query -> fetch_array()){
echo "<tr>";
echo "<td>".$row["id"]."</td>";
echo "<td>".utf8_encode($row["tool_number"])."</td>";
echo "<td>".$row["type"]."</td>";
echo "</tr>";
}
echo "</table>";
}
?>
[/PHP]
Pouvez vous m aiguiller??