dennismonsewicz Posted April 2, 2008 Share Posted April 2, 2008 I have a stock photo site and I am looking for a way to track the number of downloads per image. Whats the best way to implement a system that will show the most popular downloaded images? Link to comment https://forums.phpfreaks.com/topic/99194-solved-most-popular-download/ Share on other sites More sharing options...
Daniel0 Posted April 2, 2008 Share Posted April 2, 2008 If you serve the image dynamically (e.g. by fetching info about it from a database using a primary key), then just have a column called something like downloads and increment it at each download: UPDATE images SET downloads=downloads+1 WHERE image_id=54; For getting the most popular images based on download count just do something like this: SELECT * FROM images LIMIT 10 ORDER BY downloads DESC; Link to comment https://forums.phpfreaks.com/topic/99194-solved-most-popular-download/#findComment-507516 Share on other sites More sharing options...
dennismonsewicz Posted April 2, 2008 Author Share Posted April 2, 2008 in the database, would it be an int or a varchar? Link to comment https://forums.phpfreaks.com/topic/99194-solved-most-popular-download/#findComment-507520 Share on other sites More sharing options...
Daniel0 Posted April 2, 2008 Share Posted April 2, 2008 It would be an integer. Link to comment https://forums.phpfreaks.com/topic/99194-solved-most-popular-download/#findComment-507522 Share on other sites More sharing options...
unsider Posted April 2, 2008 Share Posted April 2, 2008 integer edit: sorry VERY slow load, didn't show new repsonse... ??? Link to comment https://forums.phpfreaks.com/topic/99194-solved-most-popular-download/#findComment-507525 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.