0

Im trying to make php script that, depending on what the user chooses will update a certain row in my database. So what the program does first is that it fetches some images i've included with their attributes; then it asks the user if they like the images, and if they like a certain image the program will add 1 to the value of each attribute in the database (EX: img1 has attributes: attr1 & attr2 -> User says he likes the image --> program searches for attr1 and attr2 in the attribute table of the database and adds 1 to their previous value).

My problem is that when the program has to UPDATE the database row, it doesnt do it and there is no error.

for ($i=1; $i <=$imgresponse[4] ; $i++) {  
    $attr="attribute".$i;
    $getattr=($imgresponse[$attr]); 
    $sql= "UPDATE `gustos` SET '$getattr' = '$getattr' + 1 WHERE `idbrujula` = 1";
    $sqlquery= @mysqli_query($dbc,$sql);
}

0 Answers0