Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > PHP/MySQL > PHP How-To
Password Reminder
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
PHP How-To Post your "How do I do this with PHP?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP How-To section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Display Modes
  #1 (permalink)  
Old October 16th, 2014, 06:15 AM
Registered User
Points: 5, Level: 1
Points: 5, Level: 1 Points: 5, Level: 1 Points: 5, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Oct 2014
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to select question from mysql tables randomly or shuffle it?

I am working on a quiz app

image 1 shows the index.php page
image 2 shows the first question
image 3 shows the second question
image 4 shows the third question
image 5 shows the result after completing the quiz
image 6 shows the database 'quizzer' and its tables
image 7 shows the 'questions' table
image 8 shows the 'choices' table



1.Now my question is how to select the question RANDOMLY from 'questions' table along with 'choices' (by adding code to the existing file or create a new one).

2.If user refresh/reload the page before starting ('Start Quiz') or click 'Take Again' after finishing the quiz, the question should appear randomly.

3.Basically I want to change the order of question appearing in the browser each time I refresh.

4.My work so far is mentioned above.........Please help me with this "RANDOM" problem !!

P.S - Will it be possible, by creating a random function in PHP which will check for repeat questions in a session and check for the 'id' of the question and if it is new display it on the page.

If so what should I do and if no then how to do?
Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
HELP! how to do a joined select from two tables Greywacke MySQL 1 December 31st, 2009 05:33 AM
Select nodes randomly carlosaml XSLT 3 October 17th, 2007 10:18 AM
Select lot tables... vieritlc Classic ASP Databases 3 May 18th, 2004 07:07 AM
Display all tables in a mySql database question mb92010 MySQL 1 April 9th, 2004 04:26 PM
MySql tables godhsf80 PHP Databases 1 November 26th, 2003 12:27 PM

All times are GMT -4. The time now is 01:28 AM.

Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.