473,387 Members | 1,757 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Is there a JavaScript that will randomly select files from a database?

This is what I am looking for. So I will basically have two databases. One with the questions and one with the answers. Each database will have several tables. For example questions in database 1 table 2 will have corresponding answers in database 2 table 2. I would like a script that will randomly select a question from a table in database 1 and depending on which table it randomly selected the question from, it will then automatically go to the corresponding table in database 2 and randomly select 3 questions from that database. I basically just need the script to perform these actions. The design of the actual game is not as important at this point. Is this something you can help me out with?
Mar 2 '11 #1
2 2246
Rabbit
12,516 Expert Mod 8TB
I'm baffled as to why your questions and answers are split across multiple table and why your answers are in a different database.

But aside from that, you just need to use the random number generator function: Math.random()
Mar 2 '11 #2
If I understand the situation:
I believe that you will also need some kind of identifier column in the DBs for the program to know which question was asked and be able to match it to the correct answer.
Mar 8 '11 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Bob Bedford | last post by:
I've a site where companies add their article. I'de like to provide a "lasts articles" table. By this, I'll show last articles inserted. But I won't always the same articles at any refresh....
1
by: Jonathan Rubke | last post by:
I am getting a filename from one frame and opening it in another frame. It works fine if the file exists, but I'm trying to get it to show an error message, possibly an alert box, if the file...
0
by: Mikko Pulkkinen | last post by:
Hi, I'm trying to use Crystal Reports to generate reports from an Access database. I'm using VS2003 and C#. I need to select the database the report uses as data source at runtime. The database...
3
by: Jess | last post by:
I have tried all of the solutions given by other members on how to load a random .swf file on the load of the page, however, none of them seem to work on my site. The problem is in embedding the...
1
by: Jan | last post by:
Hi there, I have the following problem: Is there a way to select files on time or date. I mean on the time that they are saved. I have a lot of files with a certain save time/date. Thx
2
by: Scott Gordo | last post by:
<!--Newbie warning--> I've got a csv file with names, addresses, emails, etc. I've been asked to randomly select a name from a csv file. I've found plenty of RandNum examples, but I'm not sure how...
4
by: tjbvo | last post by:
Greetings I am busy with a program that randomly selects data from a databse and then populates controls with the random data. the user must then select an option that must be stored for printing...
5
by: Edwin Smith | last post by:
Hello: I'm using VS2005 with an ODBC database. I am trying to add a Dialog to an existing Database application to allow the user to select the database. We have 2 different databases with the...
1
by: fran7 | last post by:
Hi, I have this code to randomly select an image from a sequence of fields in my database. Does anyone know if rather than random, one could simply move from one field to the next sequentialy. That...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.