Quote:
Originally Posted by ProG
That should have worked. Are you sure the 'views' field is set to an integer type?
This query looks invalid. It should be something more like this:
Code:
SELECT *, DATE_FORMAT(`time`, '%M %e %Y') as `formatTime` FROM `table` ORDER BY `formatTime` DESC, `views` DESC
I think ultimately you will want to create an array for ease of outputting the data. If you only sort by views, then build the array, you will still need to sort by date (which is much easier to do with mysql).
|
views field is an integer, both of those queries output the same thing, they're printing the posts with the highest views at the top of everything, and the rest is sorted by date below them, but only because 98% of the data has 0 views because this is just in the testing stages and there are only like 2-3 posts with views over 0. Otherwise it would all probably just be sorted by views and the dates would be all mixed up.