I'm trying to make a voting system that will add +1 to the current number of votes for each photo but after writing my request I realized that it was not just modifying the photo I had noted but all the photos on the table... How can I change only the number of votes of the photo I voted for? I then tested with a "where" that will look for the id of the image I am viewing and voting for in my database, the request works well but it modifies all the images... I don't see what else I could do to make my vote go only on my image.

Thanks for any answer.

My sql code: Namely: in a for loop $good_note=$col[$i][5] that returns to a select request where I getting back all my notes and $id=$col[$i][0]; that returns id of each image

$majNote='UPDATE image SET good_note = good_note+1 WHERE image.id_img = '.$id.'';
$req=$db->query($majNote);

0 Answers