I have a database with rated items in it. When I want to display all the items from a specific category and sort the results by rate than by number of likes, it's easy and it's working:
$query = "SELECT * FROM infos WHERE category = '".$categories."'";
$query .= "ORDER BY `rate` DESC, `like` DESC";
The problem is when the results have the same value, they show up in alphabetical order. So, I would like to randomize the database before I sort it by rate and like. I just want to let the same chance to all items and those that have the same value not to be advantaged by alphabetical order.
I tried this, but it didn't work:
$query = "SELECT * FROM infos WHERE category = '".$categories."'";
$query .= "ORDER BY RAND(), ORDER BY `rate` DESC, `like` DESC";
Can somebody help me? I'm stuck.