Suppose I'm connected to a database and I do the following:

$query = "Select q_id, question From questions Order by q_id";

$result = mysql_query($query);

Now, what is the best way to pull out 20 random rows from my questions
table?

I'm trying to set up on an online trivia page where different
questions are posted each time a person visits the page and I'm
pulling my list of questions out of a database.

I know mysql_fetch_array fetches one row at a time and array_rand can
pull elements out of an array at random, but I'm at a loss at how to
coordinate these two functions together to do what I want to do.




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