I'm trying to retrieve some results from a table. I want the results chosen randomly, then sorted by the number of "hits".
Here's the code I'm using:
With this syntax, the results are chosen randomly, but they are not sorted by "hits".
You can see the results at Insoogle.com (scroll to latest searches).
I'm sure there's a simple fix for the code I'm using. I just can't seem to figure it out.
Here's the code I'm using:
Code:
<?php $latestQuery = "SELECT * FROM pages ORDER BY RAND(), hits DESC LIMIT 100"; ?>
You can see the results at Insoogle.com (scroll to latest searches).
I'm sure there's a simple fix for the code I'm using. I just can't seem to figure it out.
Comment