Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Should I put questions and answers in the same database?

Posted on 2002-07-23
7
Medium Priority
?
132 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
Looking for a new Web Host?

Lunarpages' assortment of hosting products and solutions ensure a perfect fit for anyone looking to get their vision or products to market. Our award winning customer support and 30-day money back guarantee show the pride we take in being the industry's premier MSP.

 

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

Simplify Your Workload with One Tool

How do you combat today’s intelligent hacker while managing multiple domains and platforms? By simplifying your workload with one tool. With Lunarpages hosting through Plesk Onyx, you can:

Automate SSL generation and installation with two clicks
Experience total server control

Question has a verified solution.

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

Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

618 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