[Solved] Order by DESC not working for custom variable $how


You currently have a function that defaults to showing 15 rows sorted by added. You can change this one of two ways:

Change the function itself. This will make the DEFAULT value be site_views:

function list_videos($how = 'site_views', $limit="15") { // newest, top views, etc etc etc

Now if you call list_videos(), you will get 15 results ordered by site views desc.

OR

You can just change how you call the function in a certain place:

list_videos('site_views', 25);

This would order by site_views and show up to 25.

list_videos('video_title', 25);

Another example, probably not good to sort by name DESC but you get the idea…

15

solved Order by DESC not working for custom variable $how