Web hosting services - 896Part VCase Studies3.Query the previous question to discover
896Part VCase Studies3.Query the previous question to discover the range of the guess and whether the ques- tion was correctly answered. Update all scores (credit, correct answers) appropriately. 4.Decide whether to promote the player to a new level now. If so, retrieve the databaseIDs of all questions that may be asked at that level. Randomize the order of the ques- tion list. 5.If the game has not yet ended, grab a new question ID from the randomized list and useit to ask the database for a new question. Turn that data into a Questionobject andmake it the current question. Serialization and sleep() The sleep()function is called to do cleanup whenever an object is serialized and alsoreturns a list of all the member variables that should be recorded in a serialization. The Gameclass makes use of only the latter capability all member variables except the previousquestion and the database connection itself are retained as the object is stored in the sessionfor the next page s use. Unlike with some other class definitions, we ve defined Game s variables to be public. This isbecause in our testing with PHP5.0b1, we discovered that private variables were not surviv- ing the serialization process. This may be fixed by the time PHP5.0 is released. game_parameters.phpThe single instance of the GameParametersclass, shown in Listing 46-5, packages up all thedefault numbers that we may want to customize in making a new version of the game (thepenalties and rewards, the number of levels, the starting and maximum credit, and so on). In addition, this object manages global access to the database connection. Listing 46-5:game_parameters.phpIn case you need quality webspace to host and run your web applications, try our personal web hosting services.