Jump to content

"Most Popular" Script


eRott

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.