KevHopwood Posted September 10, 2013 Share Posted September 10, 2013 Hi all. I have a mobile cms website situated <a href="http://www.xclo.mobi/xclo2">here</a> all of my apps and offers are located in a database. Is there a way for me to add a popular / most visited section to my site that reads how many times each offer has been viewed and for it to display a lost of the top 5. Can some one help me on how to do this? Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/282039-top-5-most-viewed/ Share on other sites More sharing options...
fastsol Posted September 10, 2013 Share Posted September 10, 2013 Here's a tutorial on how to setup the page hit counter. http://www.youtube.com/playlist?list=PLD527AE17B0A9F1F1 Then you can do some simple queries to get the top 5 highest views. Quote Link to comment https://forums.phpfreaks.com/topic/282039-top-5-most-viewed/#findComment-1448974 Share on other sites More sharing options...
cataiin Posted September 10, 2013 Share Posted September 10, 2013 (edited) count views: mysql_query("UPDATE apps SET views=views+1 WHERE id='".$id."'"); show 5 most viewed: mysql_query("SELECT * FROM apps ORDER BY views DESC LIMIT 0, 5"); Don't forget to add column "views". My code is just an example. Edited September 10, 2013 by cataiin Quote Link to comment https://forums.phpfreaks.com/topic/282039-top-5-most-viewed/#findComment-1448979 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.