Adam,
I'm what I would call a novice to PHP and databases in general, however if I
had to do what you're doing, I might do the following...
Add a field to the table that contains your questions called displayed and
have it be an enum of Yes/No True/False, etc... In your script, you'd then
query for all the questions that haven't already been displayed. Then get a
random one of those (plenty of randomizing functions in PHP I believe).
Display it, mark it as displayed in the db... Next time, it won't even get
returned in the query. I don't know if you have to do this on a per-user
basis or what. If so, you will probably have to create a session table and
keep track of the questions each user has viewed... Hope this gets you
started... Cheers!
My 2 ยข
John Pickett
http://www.bvstudios.com/
Co-Author: Inside Dreamweaver 4
http://www.amazon.com/exec/obidos/ASIN/0735710848/xtremist
- Original Message -
From: Adam Lundrigan [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, July 31, 2001 2:32 PM
Subject: [PHP-DB] Random question selection in PHP w/ MySQL backend.
I'm having a bit of trouble creating a random question selector. I'm using
PHP 4.0.6 and MySQL 3.23.36 on Windows 98 SE.
I've tried several different solutions, but none work at all.
What i need to do is select 10 questions from a database (db: vpt, table:
questions), and make sure that the same question doesn't appear twice. The
questions need to appear in a random order each time the script is loaded.
It sounds simple enough, but i just can't seem to get it to work.
Any suggestions??
Thanks in advance,
-Adam Lundrigan
CEO, VPU
http://www.vpu-virtual.com/
ICQ # 73617446
[EMAIL PROTECTED]
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]