RE: [PHP] random order by id

2002-05-18 Thread David Freeman
> i have a db and a table with id and questions > now i want these questions to be listed in a random order, > is there a way to format my SQL query or do i need some PHP > work to? It's best achieved in sql: SELECT ID, Question FROM Questions WHERE Some = Condition ORDER BY RAND() LIMIT

Re: [PHP] random order by id

2002-05-18 Thread Richard Baskett
If you are using MySQL try looking at this page for the function rand(): http://www.mysql.com/doc/M/a/Mathematical_functions.html Here's a little overview of what it says: "In MySQL Version 3.23, you can, however, do: SELECT * FROM table_name ORDER BY RAND() This is useful to get a random sampl