Select One

A

Anonymous

Guest
Code:
$query ="SELECT DISTINCT series, preview FROM $table order by 'entryID' DESC";

There are many "preview"s per "series", and I was wondering if there's a way for me to call only 1 random "preview" from the "series".

Thanks!
 
yeah, use LIMIT 1 and order by rand() - that will get you just the 1 random result you want...

Andrew
 
Code:
$query ="SELECT DISTINCT series, preview FROM $table order by rand('preview') DESC LIMIT 1";

It shows only one series, but I want all the series showing, just with 1 random preview image with each series. Also, I'm using the LIMIT with my navigation, and with LIMIT 1, it throws off the navigation.

Thanks.

PAGE
 
Try this query:
Code:
mysql > SELECT series, preview FROM $table ORDER BY RAND() DESC LIMIT 1
 
Back
Top