I want to grab a value of a row, remove the last 2 digits of it, and set it to another row. This is what I have so far.
while($row = mysqli_fetch_assoc($query)) {
mysqli_query($con, "UPDATE my_table SET another_row = '" . substr($row['first_row'], 0, -2) . "'");
}
Table example
field1 | field2
100 | 0
200 | 0
5000 | 0
I want to set field2
to the value of `field`` minus the last 2 digits, so.
field1 | field2
100 | 1
200 | 2
5000 | 50
But it's setting the values of the rows to 0 for some reason.