Jump to content

To select data randomly from database

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
1 reply to this topic

#1
Divya

Divya

    Learning Programmer

  • Members
  • PipPipPip
  • 33 posts
I am doing a quiz site using php and mysql in which i am retrieving the questions with answers randomly from the database using ORDER BY rand() LIMIT 0,1.Now my problem is that the questions are getting repeated continuously.But it should be like i must get all the questions randomly everytime but without repeating..pls help me.c

#2
Orjan

Orjan

    Writes binary right handed and hex left handed

  • Moderators
  • 3,298 posts
the rand() would often do the same two in a row, especiellay with few questions. see my answer in the php thread for a even spread nonrepeating way to do it.
__________________________________________
I study Information Systems at Karlstad University when I'm not on CodeCall