Solved

Drawing from a Database

Posted on 2004-04-17
9
159 Views
Last Modified: 2013-12-25
Hello,

You may have noticed this isn't worth barely anything - and that's becuase I don't know if it is possible.  If it is, I will raise the points to a desired level for whoever wants to program my script.  

I think it's fairly easy.  All I want to do is have a database of questions - about 5,000 (don't worry, I'll put them in, you don't have to lol) and then whenever someone accesses a webpage, it randomly draws 20 questions out of the database and displays them onto the webpage in a multiple choice quiz.  I want to be able to put images into some of the questions.  Then, once the quetsions are there, the person who accessed the page answers the questions, hits a submit button, and vuala, there's a list of the questions she/he got right, wrong, and what the correct answers are.  There's a also a mark.  Please tell me if I can do this, and then I will raise the point value and then you can make me the script.  Thank You!

-Tyler  
0
Comment
Question by:legolasgreenleaf
[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
9 Comments
 
LVL 17

Expert Comment

by:dorward
ID: 10851134
It shouldn't be too difficult.

In the database you can have the following fields:

id - a unique integer to identify the question
question
url to image
answer a
answer b
answer c
answer d
correct answer

You can first issue the query: SELECT count(*) from tablename
Then pick 20 random numbers between 1 and that result (checking to see if you have picked one already)

For each of those numbers: SELECT * from tableneame WHERE id='number of question'

You can then structure your form along the lines of:
<p>Question</p>
<input type="radio" name="question23" value="a"> Answer A
etc

When you submit the form, you check to see the name of the submitted paramerts. From these you can extract the number of the question and SELECT answer from tablename where id='number of the question' to see if it is right or not.

0
 

Author Comment

by:legolasgreenleaf
ID: 10851740
Thank You!  Can you please write my a CGI file that can do all this?  Tell me how much you think it's worth for you to make a script like this and tell me.  If it's reasonable, I will increase the point value to that level which you told me.  Then you can write me the script, I'll try it out and make sure it will work, and I'll reward you you're well-deserved points!  Thank you!!!
0
 
LVL 1

Expert Comment

by:bkiahg
ID: 10851832
What type of database are you going to use?  Also I would recommend putting the image tags directly into the question field.  You can format them there to look exactly how you want them to.  And its one less thing to worry about.
0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
LVL 17

Expert Comment

by:dorward
ID: 10852394
No amount of EE points is going to make it worth my while writing this script from scratch. It isn't difficult, but it is somewhat time consuming and I have other projects which will benefit me far more then more EE points.

As for putting the image tags directly in the question field - I wouldn't. I would leave the whole thing as plain text. This gives greater flexibility for handing the data. For example, you could have the script email the results to you with the questions selected, or write a non-browser-based frontend - that is somewhat harder to do if you have to strip out HTML from it.
0
 

Author Comment

by:legolasgreenleaf
ID: 10854416
I'm sorry.  I don't know much about CGI.  I'll try to work it out.  Thanks anyway!
0
 
LVL 6

Accepted Solution

by:
MatthewP earned 50 total points
ID: 10861740
If you want a good beginners guide to CGI, have a look at http://www.cgi101.com. This is based around the Perl language, and there's plenty of people on here who'll more than happily help you out with the little bits if you get stuck.

Matt.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

If you get a (Blue Screen of Death), your system writes a small file called a minidump. Your first step is to make certain your computer is setup to record memory dumps. Right click My Computer, choose properties. Click on the advanced tab, an…
This tutorial will discuss the log-in process using WhizBase. In this article I assume you already know HTML. I will write the code using WhizBase Server Pages, so you need to know some basics in WBSP (you might look at some of my other articles abo…
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

740 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