What type of variable is $my_values? It seems to be an array.
PHP Code:
while ($my_value=$db->fetch_array($my_values) //this while loop goes through the array entry by entry. If there were 10 instances of field5 = $some_var from earlier, this code would be executed 10 times - once for each entry
$db->fetch_array() needs a MySQL resource as parameter, not a simple array.