TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   Absolute Beginners (http://www.talkphp.com/absolute-beginners/)
-   -   A doubt on PHP Online Quiz (http://www.talkphp.com/absolute-beginners/4760-doubt-php-online-quiz.html)

skp 07-20-2009 05:40 AM

A doubt on PHP Online Quiz
 
I just wanted to develop a web application - an online quiz, in which i need to fetch questions only once & display one at a time as the user clicks the NEXT button. But, in php ,i guess it is difficult to have the questions(data) stored & use it on the event basis(button click)(since its a mere script invocation). Whereas , in asp.net it is easily done, since the data fetched can be stored till the user ends appln. So can u suggest some ways to do it in php......? or asp.net is the only way...?

Hightower 07-20-2009 06:11 AM

Quote:

Originally Posted by skp (Post 27213)
I just wanted to develop a web application - an online quiz, in which i need to fetch questions only once & display one at a time as the user clicks the NEXT button. But, in php ,i guess it is difficult to have the questions(data) stored & use it on the event basis(button click)(since its a mere script invocation). Whereas , in asp.net it is easily done, since the data fetched can be stored till the user ends appln. So can u suggest some ways to do it in php......? or asp.net is the only way...?

I would probably store the used questions in an array (the id of each question). This can then be easily checked to make sure the question is notused twice, and also can easily be used to recall all questions/answers at the end.

skp 07-20-2009 06:18 AM

Thansk for ur reply. but i want to mak my question clear. Whether can i avoid database retrieval each time for each question for each user , wich wud mak the appln more loaded one & slow . ( for ref- in ASP.net, VB.net, as they are appln oriented, its enuf if DB Query fetch is made only once & can be displayed one at a time by moving the ADO like recordset pointer) So , is it possible to do something lik tht in php..? I wanted to reduce laod on DB engine(MySql).

codefreek 07-20-2009 07:09 AM

Please don't post the same thread in 2 different sections.


-Cf

Hightower 07-20-2009 07:19 AM

Quote:

Originally Posted by skp (Post 27216)
Thansk for ur reply. but i want to mak my question clear. Whether can i avoid database retrieval each time for each question for each user , wich wud mak the appln more loaded one & slow . ( for ref- in ASP.net, VB.net, as they are appln oriented, its enuf if DB Query fetch is made only once & can be displayed one at a time by moving the ADO like recordset pointer) So , is it possible to do something lik tht in php..? I wanted to reduce laod on DB engine(MySql).

That's possible too. Retrieve all the questions/answers you want you want and display the row (as in recordset).

Pseudo would be something like:

Get all questions/answers from db
Set a counter i.e. i = 0
Show the first row using counter
When submitted increase counter, so the next row (question/answer) is shown.


All times are GMT. The time now is 08:52 AM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0