> This thing may happen if your query contains a join generating
duplicate records (for instance because you select a limited number of
fields and not all fields). Now the rand() has a good chenca of
picking two identical result rows.

Yes, I'm using a join statement as a precaution to make sure all my
questions have an associated answer, but still I'm using distinct to
eliminate duplicates.  Anyways, here's the query that's giving me
duplicates:

$random_questions_query = "SELECT DISTINCT tgs_questions.q_id
                           FROM tgs_questions, tgs_quest_ans
                           WHERE tgs_quest_ans.q_id = tgs_questions.q_id
                           ORDER BY RAND() LIMIT 0, 5";

Right now, I'm limiting the results to 5 at a time while I'm still
working on it.  I got the form to display right, but I want to use
fewer questions to test the grading function out when I write it.




Community email addresses:
  Post message: [email protected]
  Subscribe:    [EMAIL PROTECTED]
  Unsubscribe:  [EMAIL PROTECTED]
  List owner:   [EMAIL PROTECTED]

Shortcut URL to this page:
  http://groups.yahoo.com/group/php-list 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-list/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/php-list/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

Reply via email to