Solved

Drawing from a Database

Posted on 2004-04-17
9
154 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
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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
disabled AD accounts info 3 61
How to count json data 2 56
exchange, scripts 3 49
Need to Modify a Script I found 5 77
It is becoming increasingly popular to have a front-page slider on a web site. Nearly every TV website,  magazine or online news has one on their site, and even some e-commerce sites have one. Today you can use sliders with Joomla, WordPress or …
Recently I have been answering a lot of questions like this in IT forums that I frequent. The question posed is usually something along the lines of "We have software X installed and need to uninstall it for reason Y" or some other variant of the sa…
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

747 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now