Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Drawing from a Database

Posted on 2004-04-17
9
Medium Priority
?
164 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
CHALLENGE LAB: Troubleshooting Connectivity Issues

Goal: Fix the connectivity issue in the lab's AWS environment so that you can SSH into the provided EC2 instance.  

 
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 200 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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

Introduction This tutorial will give you a fast look what you can do with WhizBase. I expect you already know how to work with HTML at least, and that you understand the basics of the internet and how the internet works. WhizBase is a server-s…
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
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 seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

704 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