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? Quote Link to comment 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; Quote Link to comment 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? Quote Link to comment Share on other sites More sharing options...
Daniel0 Posted April 2, 2008 Share Posted April 2, 2008 It would be an integer. Quote Link to comment 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... ??? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.