A php Online QUIZ
Moderator: General Moderators
A php Online QUIZ
I am developing an online php quiz in which wach user has to be given random set of questions. I just wanted to know is there any way to get (all)the questions from the database in one fetch or we have to retrieve each question every time for all concurrent users .I think this may increase the load on the database...?
Thanks in advance
Thanks in advance
Re: A php Online QUIZ
What questions from the database?
How are you hoping to retrieve them?
How are you hoping to retrieve them?
Re: A php Online QUIZ
You can fetch all questions for one user and store them in the session.
Re: A php Online QUIZ
Questions means, the ( s.no, question, ans1, ans2,ans3,ans4, right answer) . All these are to be retrieved from the db, so that database is touched only once. But here i need to show only one question at a time. So , till that i hv to store the other questions somewhere. This may be in sessions.Other ways to do so also welcome. I just wanted to reduce the load on the db ( avoiding fetching questns each time from the db).jackpf wrote:What questions from the database?
How are you hoping to retrieve them?
Re: A php Online QUIZ
Thanks for ur reply.genconv wrote:You can fetch all questions for one user and store them in the session.
Btw can u suggest any other way to do this other than using sessions (bcoz its difficult to store the entire resultset data into sessions & retrieving them back) ...?
Re: A php Online QUIZ
Well, you just have the query
and then put it in a while() loop. What's the problem with that? Why do you have to put it in a session? Sounds completely pointless to me.
Code: Select all
SELECT * FROM `Questions`Re: A php Online QUIZ
Well, this is an online quiz in which each user will be given diff set of questions. So in this i dont want to flood the DB for fetching questions each time. So we can fetch once from db using select * from query. But have to be stored some where , bcoz only one question is to be shown to the user at a time. when he clicks 'next' button, the next questions shud be displayed. So suggest me now..jackpf wrote:Well, you just have the queryand then put it in a while() loop. What's the problem with that? Why do you have to put it in a session? Sounds completely pointless to me.Code: Select all
SELECT * FROM `Questions`
thanks
Re: A php Online QUIZ
As I said in one of your other threads, sessions basically are databases. You still have to retrieve the data.
Re: A php Online QUIZ
ok . so I guess u are trying to say retrieving from database each time for each question for each user will be the most suitable solution. So this may lead to server overload ( in the database engine) . So hw to avoid such a problem.....?
I am using WAMP( APache server ) .I Need to support minimum of 200 concurrent users.
Thanks in advance.
I am using WAMP( APache server ) .I Need to support minimum of 200 concurrent users.
Thanks in advance.
Re: A php Online QUIZ
Just make sure you're data is normalised, optimised, and you're not doing any crazy joins or anything.
Just straight SELECT queries take about 0.0001 seconds or something, I doubt 200 users concurrently would do too much damage.
You could use AJAX, rather than requesting whole new pages, as I think this is faster and requires less bandwidth etc, since the connection is kept open. Idk, you could give it a try....
Just straight SELECT queries take about 0.0001 seconds or something, I doubt 200 users concurrently would do too much damage.
You could use AJAX, rather than requesting whole new pages, as I think this is faster and requires less bandwidth etc, since the connection is kept open. Idk, you could give it a try....