...

View Full Version : showing next question in flash from MySQL and PHP



samantha_c
03-20-2008, 11:50 AM
Hi,

I have been reading through the forums and trial an error for 2 days, I am trying to do an interactive quiz, the quiz question is stored in a mySQL table calling through PHP. I have got it working by passing the first question(by using the codes from flash-db.com) the problem now is I need to retrieve the next question, but i can't figure out how.

2 things I am suspecting:

1. I suspect that I hard code the textfield.text with textfield0.text in my obj.
2. the output of trace is something like this:



tQuest0
qDuration0
00:02:00
tQuest1
qDuration1
00:02:00
tQuest2
qDuration2
00:02:00

It has actually pass every row in mySQL table to flash. If so, how can i control each question?



I am glad that anyone can help with the codes or show my some hint or tutorials. I am relatively new to programming.


Below is the code i am using.




myData = new LoadVars()
myData.load("http://localhost/quiz.php")
myData.ref = this
myData.onLoad = function(success){
if(success){
for(var i=0; i<this.cant; i++){
this.ref["qNumber"+i].text = i+1;
this.ref["qTotal"+i].text = this["cant"];
this.ref["tQuest"+i].text = this["Title"+i];
trace("tQuest"+i);
this.qDuration0.text = this.ref["qDuration"+i].text = this["Duration"+i];
duration = qDuration0.text;//this is to pass the value to start the timer
txt = counterTxt1.text;
counter(counterTxt1,duration,"no",false);
i = i+1;//is this the correct way to retrieve the next question from DB
}
}

else {
trace("Error loading data")
}


}



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum