I think you can do that with a simple update statement using the "MySQLi Execute Query" server behavior like:
UPDATE fotos SET fotosORD = fotosID WHERE fotos.fotosSUBCATID = col_cat AND fotos.fotosORD = col_orden
and use parameters for col_cat and col_orden mimicking the recordset you have currently.