I'll take a stab at it if you can reword your exact question to make more sense ;-) Not trying to be mean here, but your original post is a bit fuzzy.
It sounds like you need to read all the rows in for the gameid you're dealing with into an array, then you can use:
$nextID = $ArrayOfIDsForThisGame[$currentIDKey + 1]
does that help?
best
Eric