1

I know close to zero when it comes to SQL.

I've been looking in the code of a theme I have and it's pulling the images in order

$get_imgs = mysql_query("SELECT file FROM uploaded_images ORDER BY id DESC LIMIT 0, $results");

How can I change the order to random?

Would I just change the ORDER to RANDOM?

Darren
  • 68,902
  • 24
  • 138
  • 144
VK27
  • 515
  • 2
  • 9
  • 19
  • possible duplicate of [MySQL: How to retrieve a random row or multiple random rows?](http://stackoverflow.com/questions/4586858/mysql-how-to-retrieve-a-random-row-or-multiple-random-rows) – Ben Apr 14 '12 at 13:01

1 Answers1

5
$get_imgs = mysql_query("SELECT file FROM uploaded_images ORDER BY RAND() LIMIT 0, $results");
Darren
  • 68,902
  • 24
  • 138
  • 144