?
Solved

Should I put questions and answers in the same database?

Posted on 2002-07-23
7
Medium Priority
?
130 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 400 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
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 

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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

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…
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Suggested Courses
Course of the Month13 days, 7 hours left to enroll

800 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