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 Link to comment https://forums.phpfreaks.com/topic/49031-most-popular-script/ 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. Link to comment https://forums.phpfreaks.com/topic/49031-most-popular-script/#findComment-240309 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.