I need help sorting with php mysql I have a list of items with ratings (people can rate from 1-5 stars) Now I want to show newly added items first and sort by rating and total votes so how do I show by highest rating but its only eligible if it has at least a total vote count of 20 votes but also sort by id (id DESC shows newest items) my fields are id, rate, total votes Any help would be greatly appreciated...thanks in advance!
Typically something like ORDER BY rate, id DESC; what that'll do is order by rate then by id , basically when the rating is the same it'll sort by ID anything more complex may need two queries.
Ok thanks....any idea how can put some sort of if statement to see if total votes is higher than a certain numbers?
So you want to see all items even with a total_vote_count less than 19? Then just do your processing in PHP if ($row['total_vote_count'] > 19) { .. }