this is my code but it does not work I want a code that makes a like button for every img and if they press a button the need for waarde + 1 is to be done. but why does this code not work, he connects it well with the database but he does not do anything waarde +1
what he is doing now he increases the value of the first row in the database and it does not matter which button you click
$sql="SELECT url, categorie FROM url";
if ($result=mysqli_query($conn,$sql))
{
while ($row=mysqli_fetch_row($result)) {
$url = $row[0];
?>
<div class="col-12 col-sm-6 col-lg-3 isotope-item <?php echo $row[1]; ?>">
<div class="image-gallery-item mb-4 pb-3">
<a href="<?php echo $row[0]; ?>" class="lightbox-portfolio">
<span class="thumb-info custom-thumb-info-1">
<span class="thumb-info-wrapper">
<span class="thumb-info-plus"></span>
<img src="<?php echo $row[0]; ?>" class="img-fluid" alt="">
<form action="" method="POST">
<button type="submit" value="<?php echo $url;?>" class="btn-floating waves-effect waves-dark transparent" name="like">
<i class="material-icons blue-text">thumb_up</i>
</button>
</form>
</span>
</span>
</a>
</div>
</div>
<?php
}
if(isset($_POST['like'])){
$sql = "UPDATE url SET waarde = waarde + 1 WHERE url = '".$url."'";
if ($conn->query($sql) === TRUE) {
echo "Record updated successfully";
} else {
echo "Error updating record: " . $conn->error;
}
$conn->close();
}
mysqli_free_result($result);
}
mysqli_close($connection);
?>
can somebody help me?