Solved

Should I put questions and answers in the same database?

Posted on 2002-07-23
7
129 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
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 

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

Enroll in June's Course of the Month

June's Course of the Month is now available! Every 10 seconds, a consumer gets hit with ransomware. Refresh your knowledge of ransomware best practices by enrolling in this month's complimentary course for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

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

This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
A web service (http://en.wikipedia.org/wiki/Web_service) is a software related technology that facilitates machine-to-machine interaction over a network. This article helps beginners in creating and consuming a web service using the ColdFusion Ma…
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

688 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