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
  • 66,506
  • 23
  • 132
  • 141
VK27
  • 505
  • 2
  • 8
  • 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
  • 66,506
  • 23
  • 132
  • 141