mysqli_fetch_array
returns an array per row, and requires you to loop the call to work with each result. Also, to call an element from the array you need $row['product_id']
not $row['$product_id']
while($row = mysqli_fetch_array($result, MYSQLI_ASSOC)){
if(isset($row['product_id'])) {
echo "<p>No note </p>";
} else {
echo "<p>have note </p>";
}
}
If you want to display all records from the database, regardless of product_id
, you can change your query to:
$query = "SELECT product_id FROM notes";