Thank you for your response.
PhotoIds is just an array of photoIds inside of the album. I just loop around the photoset and get all the photoIds and put it into the string.
The photoId is the primaryPhotoID. I will make a change that will call it primaryPhotoID.
The top function works and it successfully changes the primary photo, however I feel that it should be much easier to change the primary photo.
I believe the second function should work as it is, you should not have to do everything the top function requires.
It is not being cached because I checked the flickr's website and it was the old photo still on there.