This isn't related to wordpress, but I'd like to access the DB and my setup is: log_downloads table, inside is video_id column and each has the recorded id of each video downloaded. What php do I use to display the most popular videos from the site? Cheers
LOL you need a custom writen script that can do that for you, there isn't a 'script' that figures that out for you! If you like to develop it yourselve, please tell us more about your tables and fields (mysql)
you should have made a video table and inside that table should stored no. of downloads. fetching most viewed from download table is not easy. probably you have to search the whole no. of videos agaisnt views.
If I understood correctly you have a table where you register each download. The video_id is a foreign key of another table (containing the video information). If so something like this should do the trick: SELECT video_id, COUNT(*) AS num FROM log_download GROUP BY video_id ORDER BY COUNT(*) DESC Code (markup):