Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trivia quiz help 1

Status
Not open for further replies.
for flash 5 you will have to use loadvariablesnum to load in a question

im not sure which side you are having trouble with. flash or server.

some more info?

_______________________________________
You know you're old if you can remember when bacon, eggs and sunshine were good for you
 
Hi Bill,

I am familiar with the loadVariablesNum action, it is the setting up of the MySQL databsae and the PHP script that I am unsure about!

Thanks!
 
do you have phpMyAdmin ?

if so create your table there...easiest option. i guess you need a question, 3 answers, and a correct answer in each row.

if you dont i can post a php script that will create the database for you

_______________________________________
You know you're old if you can remember when bacon, eggs and sunshine were good for you
 
Hi Bill,

If you wouldn't mind posting that PHP script to create the database, I would be very grateful.

Thanks

webtoon
 

there are 2 files quiz_setup.php which you dont have to touch

open the file my_cfg with notepad or something similar
and edit these 3 lines

$db_host = localhost;
$db_user = bill;
$db_pw = celtic;

change to your host, your username, your password.

put both files on your server then open a browser window and enter the address to the set up file

thats all you have to do. the php file will display alls well or give an error message. the only error can come from the lines you edited above so as long as you have that info there should be no problems.

once the database and the table are created you can delete the setup file.

the table this will create will allow for a question, 3 possible answers (all text fields) and answer (an integer) corresponding to one of the answers. 1 = answerA 2= answerB etc

_______________________________________
You know you're old if you can remember when bacon, eggs and sunshine were good for you
 
Hi Bill,

Many thanks for posting that PHP script the other day to assist me in creating a database, unfortunately when I clicked on your link I got an error message. I have since managed to download and install phpMyAdmin and with my limited MySQL knowledge I think I have created a database called 'trivia' and a table called 'questions', the SQL is below if you want to run your eye over it or you spot a mistake?

CREATE TABLE questions (
ID int(11) NOT NULL auto_increment,
Question blob NOT NULL,
AnswerA tinyblob NOT NULL,
AnswerB tinyblob NOT NULL,
AnswerC tinyblob NOT NULL,
CorrectAns tinyblob NOT NULL,
PRIMARY KEY (ID)
) TYPE=MyISAM;

I have changed the text fields in the Flash movie to correspond to the variables in the database. So I suppose what I need now is a php script to link to the database and I would be really grateful of any help here. I would like to fill my databsae with say 100 questions, and each trivia game would have 10 questions, so that if the user played the game again straight away they would get 10 randomly different questions from the database. Am I right in thinking then that when I have the php script I just use the loadVariablesNum command in the Flash movie like this example
filename="trivia.php"
loadVariablesNum (filename, 0);

I really appreciate your time and patience on this !

webtoonist
 
the sql is fine...much the same as mine.

when i post files they are on home pc and so not available 24/7 so if you get an error message try back later.

before i knock together a script you need to think about the flash side. loadvariablenum loads values into text boxes so it might be better to have the php return just 1 random question at a time. you could have a next question button which would help keep count and vanish after question 10 or whatever.

once you have this bit straight let me know. 1 question or 10 ?

_______________________________________
You know you're old if you can remember when bacon, eggs and sunshine were good for you
 
Hi Bill,

Yes, 1 random question at a time seems the best !

Thank you

webtoonist
 
Hi Bill,

Just want to say thank you for all your help with the Trivia Quiz script, I was able to load the questions into the Flash movie. There is just one thing, it sometimes happens that the question that appears has the choice of answers for another question and it can make the game go out of sync. Is this common or could it be a problem with my Flash movie or actionscript ?

Appreciate your time

webtoonist
 
there is a problem somewhere

first check your database and make sure all is well there. ie the right answers are in the row with each question.

if thats ok then post your actionscript. the bit where you call for questions.

_______________________________________
You know you're old if you can remember when bacon, eggs and sunshine were good for you
 
Hi Bill,
Thanks again for all the help with the Trvia Quiz I managed to get it working great. I have one other question if you don't mind. Is it possible to attach a counter( hidden or displayed ) to a Flash button within the Flash movie that will show how many times the the quiz game has actually been played as opposed to stats for how many times the quiz game was just viewed ?
 
you will be able to adapt the scripts you already have to record page hits.

no problem to have a button (start buton?) that when clicked either increments a text file or a mysql database. as i say the scripts you are using re views will do fine for this purpose with only minimal changes.

again if you have trouble with the script let me know.

i turned this thread into another download but thats using mx and no good for you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top