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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.