View Single Post
Old 01-15-2013, 09:27 PM   PM User | #2
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,556
Thanks: 62
Thanked 4,055 Times in 4,024 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
Ummm...well yeah, that's what your query asked for.
Code:
ORDER BY emailed_value desc, rating_value DESC limit 0, $display_nr";
Apparently, you want the more "important" jokes (by emailed_value, whatever that is, and then by rating_value). If you truly want random jokes, than you need to abandon the use of those "importance" qualifiers.

So just change it to
Code:
ORDER BY RAND() LIMIT 10
And then you will not need or want that ugly generate_random_array( ) function. The records *WILL* be in random order, already.
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Old Pedant is offline   Reply With Quote