Solved

Should I put questions and answers in the same database?

Posted on 2002-07-23
7
128 Views
Last Modified: 2013-12-24
Hi...

If I create a website with questions and let user answers my questions, should those questions and answers be in one database (different table, of course) or should it be in 2 separate databases? I am just thinking will this have any effect from security point of view? I would like those "answers" to be very secure and wonder how should I go about it.

Then, from programming point of view, how should I write a program to check for correct answers and reply the user?

Hope I can get some help on this and I only have 100 points left, if you don't mind...

Thanks a lot.
JH Lai
0
Comment
Question by:buybuy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
7 Comments
 
LVL 5

Accepted Solution

by:
CFXPERT earned 100 total points
ID: 7172405
The questions and answers can be in two tables under one database.  Having them in two seperate databases would not increase any kind of security that I can see.

Question Table:
questID  auto increment number
question varchar (whatever length will be enough)

Answer Table:
questID  (ID of question from question table)
answerID (auto incement number)
answerCode (a,b,c,d, etc)
answerDesc  varchar (actual text for the answer)

As far as the programming goes.  I would ask a question then give the user some multiple choice answers.  If the user checks "A" then hits submit you would then pass both the questionID and the answerCOde that the user chose and query your answer table like so:

<cfquery name="getAnswer" datasource="whatever">
select answerCode
from answer
where questID = #form.questID#
and answerCode = '#form.answerCode#'
</cfquery>

Then check to see if the user was correct.

<cfif getAnswer.recordcount EQ 1>
***Correct Answer***
<cfelse>
***Wrong Answer***
</cfif>

This methodology can be easily enhanced and improved on but this should give you some basic understanding and fundementals to get you going in the right direction.

Hope this helps you out.

KWK
0
 
LVL 5

Expert Comment

by:Yog
ID: 7172845
yeah in addition, if you dont want other admins to read question you can encrypt the text when saving to DB and decrypt when displaying..
0
 
LVL 5

Expert Comment

by:CFXPERT
ID: 7173033
Any luck yet buybuy?
0
Simple, centralized multimedia control

Watch and learn to see how ATEN provided an easy and effective way for three jointly-owned pubs to control the 60 televisions located across their three venues utilizing the ATEN Control System, Modular Matrix Switch and HDBaseT extenders.

 

Author Comment

by:buybuy
ID: 7176757
It works great! Thanks.

If I have 10 questions, would it be easier to store those answers in a temporary table and check for correct answer later on?

I am not sure how after

<cfif getAnswer.recordcount EQ 1>
***Correct Answer***
<cfelse>
***Wrong Answer***
</cfif>

that I can go to next question. Any suggestions? Which one of the above is preferred? Thanks again.
0
 

Author Comment

by:buybuy
ID: 7176829
And... How to write a program to limit each question to 1 minit? After that, it will automatically goes to next question.
0
 
LVL 5

Expert Comment

by:CFXPERT
ID: 7177778
There are a few ways to accomplish this task.  One way would be to simply give the user one page with all the questions and multiple choice answers.  Once the user has answered all 10 questions he or she will press a submit button called "Grade Test".

You simply post all of the fields (checkboxes) to your grading script.

Grading Script will take all of these answers and check them one at a time against the answer table.

Then you can output the results to the user.

If you need some actual code written I'll be happy to write some stuff for ya for some extra points of course.

As far as limiting them to 1 minute, well that just depends how you want the test set up.  If you want 1 question per page then just add a javascript timer when the page laods  something like setTimeout(next,1000) then then function next() goes to the next question but this kind of defeats the form submittal method.  You could use cold fusion sessions or cookies to carry over the answers to the next page and then finally the grading page.  Kinda like a shopping cart methodology.
0
 

Author Comment

by:buybuy
ID: 7181463
Yes. CFXPERT. I need some actual code, but later. Right now, I need to do something else (Coldfusion too). How can I contact you? I will need your assistance in that area and I will send you e-mail regarding that. And find out from you how many points it will take to do it if you can help.

Then, I will post the question here and wait for you comment so I can transfer the point to you. I think this is how it should be done, right? I am very new to this site and used up 300 points already, for 2 questions. :) But no regret, I love this site. I will buy more points (not too expensive) but don't like the 3.8 foreign exchange rate.

You can send me e-mail to: laijh@hotmail.com
0

Featured Post

Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question