eRott Posted April 28, 2007 Share Posted April 28, 2007 Does anyone know a good script or tutorial on how to make a 'most popular [insert item here]' tracker. For example, to show a section on a website which lists the most visited links. Like this for example. But some REALLY simple: http://www.hotscripts.com/Popular/index.html Quote Link to comment Share on other sites More sharing options...
steelmanronald06 Posted April 28, 2007 Share Posted April 28, 2007 This forum isn't for telling you the code, it is for troubleshooting your existing code. But, here is the logic behind it. For my example we will use the most visited links: Create a table called Link ID, Link Name, URL, and Click Count. Then insert your link names and urls and make their count zero by default. on page list.php have all the links listed. The query should be SELECT * FROM table ORDER BY click_count DESC . That means that the most popular link will be at the top and least popular at the bottom. Now when someone clicks the link the link id shoudl be inserted in the url (we will say the link's id is 3) on the page count.php?id=3 it should do a query to update the links Link Count column by 1 where the link id equals the id (you get that on $id=$_REQUEST['id']; ) And then have the URL inserted into a header like so ( header(Location: "$url"); ) Granted this is very very very rough logic, but you can surely work from there. 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.