php update with returning values from one function to another