Forum BigDB Load Objects from a table

Discussion and help relating to the PlayerIO database solution, BigDB.

Load Objects from a table

Postby emcevoy » April 4th, 2013, 3:10 pm

I am trying to load an object from a database on the server side and broadcast the results back to the client.

I have a table called "Categories" which contains 10 objects. These objects hold different categories of questions for a quiz game I am developing e.g sport, film, music, politics etc..

Sample object in the Categories table:
Object Key = sport
CAtID = 1 ( each category object has a different numerical id)

I have another table called "Questions" which holds questions relating to each category. Each question has a number of properties one of which is called CatID which is also in the Categories table.

Sample object in the Questions table:
Object Key = spq1
QuestionID = 1
QuestionText = Who won the first world cup?
CatID = 1
Answer1 = Brazil
Answer2 = Argentina
Answer3 = Uraguay
Answer4 = Spain

I also have an "Answers" table which holds the correct answer for each question. Each answer has a number of properties one of which is called CAtID - relates to the category and another which is called QuestionID which relates to the question.

Sample object in the Answers table:
Object Key = spqans1
CatID = 1
QuestionID = 1
CorrectAnswerID = 3
CorrectAnswer = Uraguay

I have messaging going between the client and the server where a player chooses 5 categories from the 10 available. These are placed in an array and his selection gets checked against the database which checks that the categories exist. The server sends a message back to the client confirming the players selection and that they exist.

Once this stage has been reached I need to move to the next one which is where a question object gets sent to the player.

I want to send a question object and its 4 answers to the client. These answers will be put in place holders which will have variable names attached to them in Actionscript. The player will select one of the answers - his selection will be sent back to the server where it will be checked against the Answers table. If the place holder variable matches the CorrectAnswerID in the Answers table the player will be sent back a message indicating he has chosen the right answer. If he has chosen the wrong answer he will get sent a message indicating his answer is incorrect.

Any guidance on how all of this can be achieved would be greatly appreciated
emcevoy
 
Posts: 5
Joined: January 22nd, 2013, 4:57 pm

Re: Load Objects from a table

Postby emcevoy » April 10th, 2013, 12:17 am

Problem solved
emcevoy
 
Posts: 5
Joined: January 22nd, 2013, 4:57 pm


Return to BigDB